Hi,

Im using an Activestate Perl (fairly recent) for a script to upload a file to a web 
server.

The recieval script works fine (tested with IE5 as the client), but when i use Perl as 
the client ie get the following prepended to the file;
ntent-Type: text/plain

Then a single newline. When using IE5 as the client it sends the file intact with the 
Content Type header as a POST variable. Basically i would like to know how to make my 
upload work :) I have included the script below (which is copied almost from the LWP 
doco).

If you do have an answer, could you please also CC me direct as im not a member of 
this list.



require LWP;

$file = "./somefile.txt";
$filename = "somefile.txt";

use HTTP::Request::Common;
$ua = LWP::UserAgent->new;

my $req = POST 'http://172.16.90.174/test/fileupload2/accept-file.htm',
     Content_Type => 'multipart/form-data',
     Content      => [
                      var1       => 'Some other post vars',
                      userfile   => [$file,$filename],
                     ];

print $ua->request($req)->as_string;






Mark Nold
[EMAIL PROTECTED]
Systems Consultant
"Change is inevitable - except from vending machines"

Reply via email to