my $reg = HTTP::Request->new("POST"=>"https://$server/upload"); $reg->content_type("multipart/form-data"); $reg->header("X-Update-Nonce"=>$nonce); $reg->content([ 'label'=>'TestFile.pdf', 'file'=>['test.pdf'] ]); print "REQUEST\n".$reg->as_string();
A couple of problems, i have to use the header multipart/form-data or else the server returns an error. Where the documentation for http::request::common says to use content-type of form-data alone? (content_type('form-data') vs ('multipart/form-data'))
If i just use "form-data" i get a 400 Bad Request, the header has to be multipart/form-data
When i print out the Request it isn't converting the "Content" correctly, it is printing out the Array Ref instead. I've tried to format the content different ways but none of them have produced what i need. In the documentation of HTTP::Request it specifies that content is a string of bytes.. I'm not sure what they are referring too, i haven't been able to get any of the example code in the documentation to work like it should.
This is what i prints out
POST https://xxxxx/upload Content-Type: multipart/form-data X-Update-Nonce: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ARRAY(0x9dec0d8)
The array is where the content is suppose to be but i haven't gotten it to fill out correctly yet.
Any Ideas? - Thanks
In reply to multipart/form-data content problem by H-street
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |