[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: <FILE> upload using Perl



> > I just want a code snippet of the "PerlScriptThatIWant.pl" This CGI-perl
> > script should read the POST request, and put all this file data into a
> > file called "TEMPFILE"
> 
> Such a script would be dependent on the encoding of the data.
> Are you expecting application/x-www-form-urlencoded or
> multipart/form-data ? I'd guess the latter. In that case you need
> something that accesses the MIME library too.

I dont know in which form the web client(netscape) will be sending the
data, but i would like to recieve it in the form of
application/octet-stream.

I tried capturing the request sent to the webserver. It says:

---8<---
Content-type: application/x-www-form-urlencoded
Content-length: 168

TestDriverExecutable=%2Fhome%2Frohit%2FUploadTest.htm
---8<---

Okay, the name of the file is going with the form data, but is the data
also going as another POST by the browser? I'm not sure coz i used a
hacked up java portlistener which listened to only the first HTTP
request that came to it.

Actually, I intend to use java servlets to get the file data enevtually,
but i remember having read some perl code somewhere which did the same
thing using Perl. Can anyone give me some pointers?

To restate the problem, if i'm not already clear, i'll give a similar
example which all of us have used:

When we send a mail using Hotmail, we can "attach" files...
So, when we click attach, a file-dialog box pops us, and we specify
which file to upload. If a cgi-perl was the ACTION of that file dialog
form, then what would that look like?

TIA,
Rohit