in reply to LWP and POST (Oh no, not again)
You must set proper content type. And I just can't figure out why are you trying to base64 encode the file. Without the headers is base64 encoding pointless.use LWP; my $ua = LWP::UserAgent->new; my $req = HTTP::Request->new( POST => $url); $req->content_type('image/jpeg'); open(FILE,$filename); $req->content(join('',<FILE>)); close(FILE); my $res = $ua->request($req); die("Bzzzzzzz, error!") unless $res->is_success;
If server does not support direct upload of picture this way, you should probably encode it as a part of HTML form. Use content type of 'multipart/form-data' and you should probably use some (MIME?) modules to build up a content with proper headers.
|
---|