Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^4: LWP::Useragent - File Upload

by bliako (Monsignor)
on Dec 20, 2018 at 22:04 UTC ( [id://1227551]=note: print w/replies, xml ) Need Help??


in reply to Re^3: LWP::Useragent - File Upload
in thread LWP::Useragent - File Upload

Hi leefp,

My advice was very narrow in that it concentrated on how to be effective in doing a POST and ignored the bigger picture of uploading a file to server. I simply spotted that your POST params were in the wrong format and alerted you.

However, for this particular case, i.e. of uploading the contents of a file, you need to send the contents of the file as multipart/form-data.

HTTP::Request can take the name of the file (via Content => [ file => [$file] ], as poj suggested) and will take care of the rest (opening the file, encoding, etc.).

So, try to add a header of Content like poj said.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1227551]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-03-28 11:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found