#!/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"; }