PerlRob has asked for the wisdom of the Perl Monks concerning the following question:
<form enctype="multipart/form-data" action="http://example.com" method +="post"> <input type="file" size="50" name="file_0"/><br /><br /> <input type="submit" value="Attach File(s)" name="confirm"/> </form>
use strict; use warnings; use LWP::UserAgent; use HTTP::Request::Common; my $userAgent = LWP::UserAgent->new(); my $request = HTTP::Request->new(POST 'http://example.com', Content_Ty +pe => 'multipart/form-data', Content => [file_0 => ['options2.txt']]) +; $request->authorization_basic('username', 'password'); my $response = $userAgent->request($request); print $response->error_as_HTML . "\n" if $response->is_error;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File upload with LWP::UserAgent
by Joost (Canon) on Jun 12, 2008 at 23:08 UTC | |
by PerlRob (Sexton) on Jun 13, 2008 at 02:11 UTC | |
by PerlRob (Sexton) on Jun 13, 2008 at 03:30 UTC | |
|
Re: File upload with LWP::UserAgent
by Anonymous Monk on Sep 16, 2008 at 14:28 UTC |