in reply to Upload Progress Bar
I did this in a mod_perl2 handler using Apache::Request, but you should be able to accomplish the same with cgi scripts. Upon the user clicking 'Upload', I used javascript to open a small status window which refreshed waiting for the presense of upload status data. Meanwhile the main window begins the upload process. An UPLOAD_HOOK (see a::r docs) subroutine measured the amount of bytes received from the client and wrote it to a status file which the monitor read.
Now, this worked very well for displaying the amount of bytes received from the user. As for determining the percentage of file uploaded, a::r provides the following useful method:
my $size = $upload->size;
However I did not find the size returned to be reliable when referenced from within the UPLOAD_HOOK subroutine. I suspect is determined once the file is fully uploaded. So I wasn't able to give the user a realistic estimation of when the file would be done uploading.
But I was able to parse the contents real-time, display the results to the user, and terminate the upload if the errors in the file exceeded a certain threshold, which got good feedback from the users. I got some flak from reviewers of the technique, but it worked very well. I was able to pass back to the user accurate information about where in the file errors were, which saved them a great deal of time.
HTH
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Upload Progress Bar
by Anonymous Monk on Dec 26, 2004 at 02:40 UTC | |
by redhotpenguin (Deacon) on Dec 26, 2004 at 06:46 UTC |