Marco Schuster schrieb:
On Sat, Nov 22, 2008 at 4:19 PM, Daniel Kinzler daniel@brightbyte.de wrote:
Does a PHP script using upload stuff get run if the file upload is complete, or will it start while still uploading? If not, can't you figure out the temporary name of the upload on the server and then run ls -lh on it?
It gets run only after the upload is complete. And even if not, and you could get the size of the temporary file, what would you do with it? You can't start sending the response until the request is complete. And even if you could, the browser would probably not start resinging it before it has finished sending the request (i.e. the upload). This is the nature of HTTP...
You could have the iframe script read its size and let the upload be handled by another frame (evil, evil, I know. But still, we can offer a fallback for people who have them disabled). Can you set PHP to name the temp upload files after an URL parameter? In this case, the Rapidshare approach would work. My approach would be then:
- User loads [[Special:Upload]], upload id is created (here 31337 for
example). Upload has two iframes in it: [[Special:Upload/Form/31337]] containing the <form>, and [[Special:Upload/Progress/31337]] containing the progress bar 2) User starts upload, Progress notices this via AJAX query (of course, this requires that one is able to set the tempfile's name, or at least know it!) and displays the bar 3) Upload finishes.
This is close to the original APC based proposal, and I'm sure it's somehow possible, even without using iframes. But it remains an ugly hack, which is tricky to setup and does not work in all environments. For wiki mediasites, the fact that requests are load-balanced between multiple webservers complicates things. The temporary upload file may be on one server while the request for status goes to another.
Again: it's possible in theory, and maybe even in practice, but it remains a fugly unreliable hack.
-- daniel