Page 1 of 1

Upload progress

Posted: Sat Jun 26, 2004 1:40 pm
by EricS
Is there any way to get the status of a file that is being uploaded through the file uploaded field of a form?

It appears to me that the PHP parser doesn't even start working till all the data from a form has been completely uploaded from a form.

Maybe this is something better done with Javascript.

Posted: Sat Jun 26, 2004 2:05 pm
by ol4pr0
The only way if i am not mistaken.

Posted: Sat Jun 26, 2004 3:55 pm
by kettle_drum
The only thing you could do is to pop up a new window with javascript when you submit the form - this will then show a window saying "please wait" or something, and then when the file has been uploaded you can have the first window close this pop-up.

Posted: Mon Jun 28, 2004 1:30 am
by rapaddict_dot_com
wats the code for this? and can it show how much % of the file is uploaded?

What I've found so far.

Posted: Mon Jun 28, 2004 1:49 am
by EricS
From what I understand, php scripts can't access raw post data as it's being uploaded. Only after the data is uploaded and pre-parsed by php can you access it.

Now this pretty must makes an upload progress bar through PHP alone impossible, because it's to late to run a progress bar AFTER the file is already loaded.

This brings me to Javascript. From what I understand, Javascript does not have the capabilities of asking the browser how far along it's upload is either. So this rules out using Javascript for an accurate progressive upload bar. Now, if I'm not mistake, Javascript can access the file size of files chosen in a file upload file, at least in IE. So you can choose an average upload speed and make a predetermined guess as to how long it will take. But this will only be a guess.

While I do not know this for certain, I've heard that PERL does have the capability of accessing raw posted data as it's uploaded. Using a combination of PERL and javascript and PHP, some one has written a package that could do an accurate progressive uploading bar.

Here's the URL http://www.raditha.com/php/progress.php