Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^3: LWP::Useragent - File Upload

by poj (Abbot)
on Dec 20, 2018 at 20:24 UTC ( #1227546=note: print w/replies, xml ) Need Help??

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

Did you try the code I posted ?


Replies are listed 'Best First'.
Re^4: LWP::Useragent - File Upload
by Anonymous Monk on Jun 23, 2020 at 13:02 UTC
    As I spent hours to make it finally work, here my working solution:
    my $ua = LWP::UserAgent->new(); my $url = "http://your_url"; my $filename = "d:\\clips\\videoclip.mp4"; my $response = $ua->post($url, ['file' => [ $filename ]], 'Content_Type' => 'form-data' # add here more header paramete +rs if necessary );
      And if you switch to single quotes, you can replace the double backslashes by single ones:
      my $filename = 'd:\clips\videoclip.mp4';
      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

        And I wonder whether backslashes are even necessary there. For most purposes (i.e. virtually everything outside of the brain-dead cmd "shells") forward slashes work just fine.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2020-09-26 02:27 GMT
Find Nodes?
    Voting Booth?
    If at first I donít succeed, I Ö

    Results (141 votes). Check out past polls.