Answer the question
In order to leave comments, you need to log in
How to send a file in the body of a POST request in Perl?
To form a request, I use the HTTP::Request::Common module.
I need the data from the file to be sent not as part of the form, but in the body of the request. This is how CURL is sent when called.
curl 'URL' --data-binary FILE
This doesn't work for me.
my $request = POST $self->{url}, Content => [ $params->{file} ];
Answer the question
In order to leave comments, you need to log in
If I understand the question correctly, then:
my $req = POST $self->{url},
Content_Type => 'form-data',
Content =>
[
$params->{file} => [ /tmp/file.name ],
];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question