I have been wanting to do this as well, so I decided to tackle the problem and come up with some solution.
Here is what I have learned so far:
1) There is absolutly no way to get filesize before upload completes.
2) Its a lot harder than I thought it would be.
Now, here are some thoughts on this.
IDEA #1)
Is there any javascript method to simply read the actual page progress indicator? You could pop open a window, and read this from parent? Something like:
parent.document.progress.value or something?
My guess would be no.
IDEA #2)
Otherwise, if you use tcpdump, you can actually see each byte being transfered and the total:
17:13:05.628815 192.168.1.1.2573 > 192.168.1.102.http: . 7826498:7827830(1332) ack 1 win 65268 (DF) (ttl 128, id 21407, len 1372)
Here you can see: 7826498:7827830
Which is "uploaded:total"
So I could write a daemon to tcpdump the traffic when something connects to a socket, watching for the person who is uploading's ip address, session id, and date/time as indicators. You could read for 3 seconds, grab the last uploaded:total , and output it in progress bar style with a page refresh.
Example:
page->socket->daeman
daemon->tcpdump->page
refresh();
This would work, but would not be a pure php solution, and may not be viewed as 100% secure. ( inproper security could allow anyone to connect and view what is being uploaded.)
Is this worth all the effort involved with this? Would many people want to use it, and have the ability to run a daemon on their host?
That seems to be the only way it is possible for now. Anyone else have any luck with this?
Well, anyone? Help? Ideas? Arg!