Make sure the file name can be resolved. You should receive an error message if it cannot be. At least I do in my version HTTP::Request::Common.
You do not need to encode binary content as Base64. (Unless, of course, the server application does not expect this format.)
Here's the full sample script:
use strict;
use warnings;
use LWP::UserAgent;
use HTTP::Request::Common 'POST';
my $ua = LWP::UserAgent->new;
my $url = 'http://localhost:8888';
my $req = POST $url,
Content_Type => 'form-data',
Content => [
submit => 1,
upfile => [ 'C:\temp\bla.zip' ],
];
my $line = '=' x 78 . "\n";
print $line, $req->as_string;
my $rsp = $ua->request( $req );
print $line, $rsp->as_string;
source
share