Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^4: LWP::Useragent - File Upload

by yourself (Novice)
on Feb 03, 2021 at 03:22 UTC ( #11127845=note: print w/replies, xml ) Need Help??


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

#!/usr/bin/perl -w use LWP::UserAgent; use JSON; use Encode; use utf8; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; my $url = "xxx"; my $token = 'x'; my $sign = 'xxxxx'; my $file = '/home/xxx/xxxxxxxxxx.jpg'; my $response = $ua->post($url, ["token" => $token, "sign" => $sign, "image" => [$file] ], 'Content_Type' => 'form-data'); if ( $response->is_success ) { print $response->decoded_content,"\n"; } else { die $response->status_line; }

the file param "image" use an Array "$file"

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2021-04-11 05:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?