This is a discussion on I need help handling form posting within the PHP General forums, part of the PHP Programming Forums category; Hi all: In my quest to make things seem easier for the user to understand, I'm trying to retrieve ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi all:
In my quest to make things seem easier for the user to understand, I'm trying to retrieve the time that I start posting a very large file via a form post. The form action sends it back to itself, which is fine. It took me some time to figure out that NOTHING happens on the client until the form has been completely transmitted to the server. In my particular case, this can be a long time, anywhere from 15 to 30 minutes. I'd like to be able to notify the user of when the file upload actually began. Is there a way that I can intercept the click of the "Upload" button, have it update a field (probably a hidden one) with a date/time stamp, and then have that value included in the $_POSTed values? I'm thinking (fearing, rather) that this is probably all off-topic and probably is best addressed with some type of JavaScript solution, but it's late, I'm not thinking clearly, and I've been doing data conversions all day, which is a sure-fire way to get me emulating some Romero zombies. Any help you can spare will be greatly appreciated. Jon |
|
|||
|
Jon Westcot wrote:
> Is there a way that I can intercept the click of the "Upload" > button, have it update a field (probably a hidden one) with a > date/time stamp, and then have that value included in the $_POSTed > values? Sure, javascript is the answer. /Per Jessen, Zürich |
|
|||
|
Per Jessen wrote:
> Jon Westcot wrote: > >> Is there a way that I can intercept the click of the "Upload" >> button, have it update a field (probably a hidden one) with a >> date/time stamp, and then have that value included in the $_POSTed >> values? > > Sure, javascript is the answer. > pseudocode: onclick="javascript:nnnnn(this)" update field with local timestamp submit form. /Per Jessen, Zürich |
|
|||
|
> Jon Westcot wrote:
> > > Is there a way that I can intercept the click of the "Upload" > > button, have it update a field (probably a hidden one) with a > > date/time stamp, and then have that value included in the $_POSTed > > values? > > Sure, javascript is the answer. But don't forget to send a server timestamp within the form. Just for the case that server time and client time may differ in some minutes (or even timezone). So on clientside, you just ADD the amount of time between initial display and submit. Or am I wrong?! so far Rob > > > /Per Jessen, Zürich |
|
|||
|
Robert.Degen@rwth-aachen.de wrote:
> But don't forget to send a server timestamp within the form. Just for > the case that server time and client time may differ in some minutes > (or even timezone). The OP said "I'd like to be able to notify the user of when the file upload actually began.", so the timestamp from the local machine is probably the best choice. /Per Jessen, Zürich |
|
|||
|
On Nov 15, 2007 12:14 PM, <admin@buskirkgraphics.com> wrote:
> FOR GODS SAKE DON'T comment on syntax or design. I DO NOT CARE this is a > example ONLY!!!!!!! > OF COURSE I LEFT OUT CODE. OF COURSE THIS IS NOT A COPY PASTE AND IT WILL > RUN!! There should be an apostrophe in "GODS" and your sentence should read "this is an example", not "a example". Overall: B+ -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. |
|
|||
|
I do this
Example: <? switch($_REQUEST['req']) { default: $click_stamp =date('is'); echo "<form action=? method=post><input type=hidden name=clicks value=$click_stamp> <input type=file name=upfile tabindex=1 size=35> <input type=submit value=upload name=req></form>"; break; case "upload": //Upload function here $dispay_time = date('is') - $_POST['$click_stamp']; Echo "<CENTER>File took $dispay_time to upload"; //Time stamp it anyway you want EXAMPLE ONLY!!!!!! break; } ?> FOR GODS SAKE DON'T comment on syntax or design. I DO NOT CARE this is a example ONLY!!!!!!! OF COURSE I LEFT OUT CODE. OF COURSE THIS IS NOT A COPY PASTE AND IT WILL RUN!! -----Original Message----- From: Jon Westcot [mailto:jon@westcot.net] Sent: Thursday, November 15, 2007 4:17 AM To: PHP General Subject: [php] I need help handling form posting Hi all: In my quest to make things seem easier for the user to understand, I'm trying to retrieve the time that I start posting a very large file via a form post. The form action sends it back to itself, which is fine. It took me some time to figure out that NOTHING happens on the client until the form has been completely transmitted to the server. In my particular case, this can be a long time, anywhere from 15 to 30 minutes. I'd like to be able to notify the user of when the file upload actually began. Is there a way that I can intercept the click of the "Upload" button, have it update a field (probably a hidden one) with a date/time stamp, and then have that value included in the $_POSTed values? I'm thinking (fearing, rather) that this is probably all off-topic and probably is best addressed with some type of JavaScript solution, but it's late, I'm not thinking clearly, and I've been doing data conversions all day, which is a sure-fire way to get me emulating some Romero zombies. Any help you can spare will be greatly appreciated. Jon |