SPUG: File uploading....
ced at carios2.ca.boeing.com
ced at carios2.ca.boeing.com
Thu Jun 22 17:40:40 CDT 2000
> Does anyone know how to send a file upload via http (ala <input type=file)
> using LWP? I can't find anything about it in the LWP or HTTP::Request
> documentation.
perhaps something like this:
#!/usr/bin/perl -w
use strict;
use LWP::UserAgent;
use HTTP::Request::Common qw( POST );
use HTTP::Response;
my $browser = LWP::UserAgent->new();
my $request = POST 'http://some_host.com/cgi-bin/some_uploader.pl',
[ filename => '/path/to/some_file_to_upload' ];
my $response = $browser->request($request);
die "request failed: ",$response->as_string, "\n"
unless $response->is_success;
print "response: ", $response->content, "\n";
__END__
Rgds,
--
Charles DeRykus
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
For Subscriptions, Email to majordomo at pm.org: ACTION spug-list EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email address
More information about the spug-list
mailing list