in reply to Apache::Request UPLOAD_HOOK
have you looked a the source for Apache::UploadMeter? It uses the UPLOAD_HOOK to implement a progress bar.
And yes, I think does have to be this complicated. It is a limitation of mod_perl 1.x and Apache 1.3.x and the forking model. Remember that the forked http child processes don't share any data, so they need to communicate through an external interface (whether that is Shared memory, a database or just a file on disk).
If you look at this process from the viepoint of the server it becomes a bit more clear. When you submit the form, two httpd child processes are used to serve the request in this instance. The main connection does the file upload, and may take several minutes to complete. The second connection is the progress meter that appears in a popup and continuously reloads itself. Now the progress meter needs info from the upload connection, but the child processes can't talk directly to each other. This is where the unique ID and external storage comes into play. The upload hook updates the data, and the progress meter displays it.
Once mod_perl2 becomes stable, there may be better ways of dealing with this. But there will always be the need for two connection from the client, and the processes that serve these 2 requests will need to talk with each other somehow.
Personally I have always thought that the browser itself should have an upload meter built in. After all they show download meters! And they have all the info to display the upload info. They could limit it to only appear when an input type 'file' is in the form...
|
|---|