slloyd has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl # Create a user agent object use LWP::UserAgent; $ua = new LWP::UserAgent; $ua->agent("AgentName/0.1 " . $ua->agent); $URL="http://www.mydomain.com/cgi-bin/upload.pl"; #uses cgi-lib218.pl + # Create a request my $req = new HTTP::Request POST => $URL; $req->content_type('multipart/form-data; boundary=lwp234892.3',['file' +,'C:\WINDOWS\Desktop\test.txt']); $req->content('table=mytest&name=lwptest1'); # Pass request to the user agent and get a response back my $res = $ua->request($req); # Check the outcome of the response if ($res->is_success) { print $res->content; } else { print "Bad luck this time\n"; }
Edit kudra, 2002-04-23 s/br/code/
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: cgi-lib error when using lwp multipart form to upload a file - what am I doing wrong?
by grep (Monsignor) on Apr 23, 2002 at 06:10 UTC | |
by slloyd (Hermit) on Apr 23, 2002 at 12:43 UTC | |
by erikharrison (Deacon) on Apr 23, 2002 at 13:36 UTC |