Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re (tilly) 2: Not listening.

by tilly (Archbishop)
on Feb 10, 2001 at 11:25 UTC ( #57595=note: print w/replies, xml ) Need Help??

in reply to Re: Not listening.
in thread File upload progress?

I have never done anything like this, and indeed my first response would be to say "impossible" meaning "if doable, much harder than you want". However it probably is possible to do this.

Were I to tackle this project (after appropriate moaning and groaning) I would crack open the source-code to CGI, and look for the file-upload part. That seems to be in a function called read_multipart. I would then create (ick) a private version of the module with a hook in that function to, based on a flag, launch a nph response and stream upload information back. Or to stream upload information back to a predictable place (based on a random ID sent to the client and returned in an obvious place - eg PATH_INFO) so that the client can have the second window going. (That is probably the saner approach to implement. Besides which the server may not be expected the CGI script to reply while the upload is going on, so the second window may be the only easy response.)

I would expect that since file uploads can be large, there would be no way that a decent webserver would accumulate the entire upload before starting the CGI.

Anyways figuring how to modify the existing CGI module to have the hook is going to be a lot easier (and better) than rolling from scratch, even though the hook will be so ugly that there is little chance it will be accepted back into the module.

There may be other ways to do it using HTTP negotiation etc. But the hack I described can probably work.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://57595]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2018-06-20 14:16 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (116 votes). Check out past polls.