Joe Orton wrote:
It is a user interface problem, so it should be done there.
It's really the only place it can be done safely

Web browsers don't offer any API to allow a client-side progress bar. The only client-side solution I know of is ActiveX and Java and these solutions are not available to all users.




sending an HTTP
response before the request body has been entirely read is fundamentally
risky, too: HTTP clients are not required to read response data
concurrently to sending request bodies, so sending the upload meter
stuff can fill the TCP send buffer server-side and deadlock the
connection for a compliant HTTP client.

Sending the upload meter stuff to the client while the client still uploads? In the same request? I have the bad feeling that the idea behind the progress meter bar was not fully understood. It's working like this:


1. Client uploads files. PHP (with the patch I posted) calls callback functions of a PHP extension to inform the PHP extension about the status of the upload.

2. The PHP extension writes the upload status to a file or to a database or to shared memory or whatever.

3. When the client starts uploading the files it also opens a javascript popup window which loads a second page (which is totally separated from the upload). It passes an upload identifier to the PHP script so the PHP script can ask the PHP extension about the status of this specific upload. The PHP script then displays this status in the javascript popup which is reloaded regularly. Instead of reloading the page it can also be done with a permanent stream of Javascript commands (like Sascha Schumann's chat module IRCG) but how it is done does not matter.

4. When the upload is complete then the javascript popup ist closed.


So ne need to send a response while the request is still read. The whole scenario can also work without Javascript if frames/iframes are used to separate the upload from the progress bar. But even this does not matter. It's all up to the user how it's implemented. All the dirty work can be done in an external PHP Extension and in PHP code. Only this little patch I sent a few days ago is needed in PHP itself.


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to