Page 1 of 2
PHP Upload Progress Bar
Posted: Wed Nov 02, 2005 3:56 am
by Grim...
Posted: Wed Nov 02, 2005 4:18 am
by Chris Corbyn
Didn't seem to do anything for me when I tried the demo.
It opened a popup, hung for a while, then threw a window that said upload complete
Again, I reckon you can do this with AJAX.
Send the file, have ajax, every 1 or 2 seconds, query the server for the file size of the upload so far, compare it against the full file size sent from the file field and do your calculations
Two nested divs always work well to make little progress bars.
Posted: Wed Nov 02, 2005 4:41 am
by Grim...
d11wtq wrote:Send the file, have ajax, every 1 or 2 seconds, query the server for the file size of the upload so far, compare it against the full file size sent from the file field and do your calculations

Where would you get the size of the original file from without going through the user's hard drive?
<edit>It worked fine for me. Did you give it a file > 1mb?</edit>
Posted: Wed Nov 02, 2005 6:34 am
by onion2k
Grim... wrote:d11wtq wrote:Send the file, have ajax, every 1 or 2 seconds, query the server for the file size of the upload so far, compare it against the full file size sent from the file field and do your calculations

Where would you get the size of the original file from without going through the user's hard drive?
You could combine the ideas from this upload thing with an ajax system .. still use the pop up window, just have it use Ajax to get the info rather than a meta refresh.
Posted: Wed Nov 02, 2005 6:57 am
by JayBird
worked for me in IE7
Posted: Wed Nov 02, 2005 7:00 am
by Chris Corbyn
Grim... wrote:Did you give it a file > 1mb?
Hmmm.. yeah it was a PDF that was 1.4MB. Usinf Firefox 1.0.5 in Linux.
I'll give it another shot.
You'd retreive the original filesize by reading the values from $_FILES['field_name'][] although I'm not sure they'd appear midway through the upload. The client sends the data as far as I'm aware.
Posted: Wed Nov 02, 2005 7:44 am
by shiznatix
perdy slick
Posted: Wed Nov 02, 2005 8:17 am
by Grim...
Worked for me in FireFox 1.0.7.
Posted: Wed Nov 02, 2005 11:10 am
by Chris Corbyn
Shhwwweeeeeeeet! Just tried it in 1.0.6 from home. Works a treat. I still reckon that's how it's done, only using a meta-refresh.
I'll have a stab using AJAX, and better DHTML so I can animate the bar sliding

Posted: Wed Nov 02, 2005 11:20 am
by shiznatix
that would be ultra slick if it was real time instead of the meta refresh.
Posted: Wed Nov 02, 2005 12:00 pm
by Chris Corbyn
shiznatix wrote:that would be ultra slick if it was real time instead of the meta refresh.
Guess what d11wtq is doing right now

Posted: Wed Nov 02, 2005 12:05 pm
by Grim...
Bashing da bishop?
Posted: Wed Nov 02, 2005 12:15 pm
by Chris Corbyn
Grim... wrote:Bashing da bishop?

How did you know?
Posted: Wed Nov 02, 2005 1:41 pm
by Chris Corbyn
I failed, on first attempt
Was trying to use ajax to do it from a single file but of course as soon as you hit the submit button it wait until the data is sent
EDIT | Ohhhhhh

It's coming to life now
EDIT again | Gives up

Posted: Wed Nov 02, 2005 2:13 pm
by Deemo
this is gonna be sweet. hurry!
