I'd like to implement a progress bar on upload to a php script. There is the grand total of nothing on the web already and normally that would indicate that it can't be done but I'm certainly set on the idea of it working somehow.
The main issue is that the script won't finish until all data is present, therefore you bar would always display 100%. To work around this, I propose to pop open a new window or make visible an iframe that calls a second script. The second script could take a look in the upload directory and compare file size written with POST query Content-Length. Simply you say?
Issues there also; namely I don't have the content length to hand - is this available anywhere client side? Ideal if it was as then it could go on a GET query string to the second script which was doing the testing. Suppose its not, what about writing it to a file somewhere or a database table which the second script could then read? There are concurrency issues there but it'd be fairly easy to have the bar display that the information wasn't there yet, and even in the worst case, I'm prepared to assume that will take only a few seconds to resolve itself.
My fear is that the content-length is only clarified after all data has arrived, in which case, I'm stumped, am I not.
Cheers for reading
Ian