View Full Version : getting an indication on a file upload progress

07-16-2004, 01:26 AM

I was wondering whether it was possible to get an indication on the progress of the upload a file to a server.

I would like to allow a user to upload a file, using the <input type="file"> tag.
The image could potentially be very large. As such I would like to display a popup window which will display a progress bar indicating the progress of the upload process.
I was wondering whether it is possible to get an indication on how many bytes have been uploaded to the server so far, so I could update the popup window to reflect how many bytes have been uploaded.

For example, the popup window would say:
"Uploaded 256K / 1.6MB, estimation: 2 minutes"
This text should change in runtime as the file is uploading. This means that the server will need to interact with the popup window (probably via an iframe).
Is the amount of bytes uploaded so far is available to me or can I obtain it somehow?

Is what I want to do at all possible using JavaScript and PHP?

I would appreciate any thought on this concept.

Roy Sinclair
07-16-2004, 06:23 PM
Unfortunately a progress bar would need to be coded into the browser itself and none of the browser makers have bothered to do so yet (at least as far as I know).

There's no progress feedback to javascript that you can use at all for providing your own substitute either.

07-16-2004, 06:39 PM
thanks for the help
I think I have found the solution in SourceForge's Mega Upload project (http://www.raditha.com/php/php-upload.php) :