CGI.pm example of reading the file:my $ua = new LWP::UserAgent; my $res = $ua->request(POST 'http://myserver.com/Parse.pl', Content_Type => 'form-data', Content => [file => ['Test.ini']]);
CGI.pm can easily pull the file variable and file. The program uploading to my CGI is doing the equivalent of this (but in Java):my $query = CGI->new(); my $file = $query->param('file'); my $mimetype = $query->uploadInfo($file)->{'Content-Type'}; my $data; binmode $file if $mimetype !~ /text/; while (read ($file, $data, 1024)) { # do something with data }
The file is stored after the Content-type: 'application/x-www-form-urlencoded' (in this case HTTP::Request is generating that for me, I could specify it). Anyway, I have not found any documentation explaining how to do this. I would like to use CGI.pm, but it seems like it parses the file (in Content-type) as if it were form-data. LWP doesn't seem to work here either. I assume this has been solved before, I just have not found the solution. Any help you can give will be greatly appreciated.my $ua = new LWP::UserAgent; my $res = $ua->request(POST 'http://myserver.com/Parse.pl', Content => $file);
In reply to File Sent via HTTP Content by cmilfo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |