Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I think I can accomplish this by using IO::Socket, creating a multipart MIME format, and stepping through the lines in the file one by one (writing to the socket). However, I do not know the protocol rules for doing this. I can send regular POSTs, but when i send the multipart POST and try to read the server response it just hangs (waiting for response). When I look at the server side nothing is uploaded. Am i missing something?
# Read file: open(FILE, $file); # Convert to multipart MIME & save in temp file # Make socket connection: $socket = IO::Socket.... # Generate HTTP POST HEADER: print $socket "POST /cgi-bin/upload.pl HT +TP/1.0\n" etc. # Read multipart temp file line by line and write to socket: while(<TE +MP>){ print $socket } # When finished (EOF): print "\n\r\n\r"; # Read server response: while(<$socket>){ print }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: uploading a file through HTTP using multipart
by chromatic (Archbishop) on Nov 22, 2000 at 00:27 UTC | |
|
Re: uploading a file through HTTP using multipart
by merlyn (Sage) on Nov 22, 2000 at 00:36 UTC | |
by Anonymous Monk on Nov 22, 2000 at 01:57 UTC | |
|
Re: uploading a file through HTTP using multipart
by amelinda (Friar) on Nov 23, 2000 at 05:45 UTC | |
|
Re: uploading a file through HTTP using multipart
by strredwolf (Chaplain) on Nov 22, 2000 at 07:51 UTC | |
|
Re: uploading a file through HTTP using multipart
by tune (Curate) on Nov 22, 2000 at 12:52 UTC |