develooper Front page | perl.libwww | Postings from January 2002

LWP::UserAgent Upload Woes.

Thread Next
Stuart Low
January 1, 2002 04:41
LWP::UserAgent Upload Woes.
Message ID:

Sorry about that, I have been onto this for days with a client getting a
little annoyed. Basically I am trying to upload a file using the LWP set of
modules to submit to a waiting POST based form. The form uses a modified
version of psupload.cgi . No matter HOW hard I try all I get is an empty
index.html file uploaded. :(

My code is as follows;

$ua = LWP::UserAgent->new;
$req = POST '',
 Content_Type  => 'form_data',
        Content      => [ login => $Russian_Username, password =>
$Russian_Password,  galleriesid => $GalleryID, FILE1 => ["index.html"],];
my $res = $ua->request($req);

As you can see it submits login, password and galleriesid as standard form
files. The file has to be submitted to the variable FILE1. WHAT is wrong
with my code? Why won't it work? It uploads the file fine but it is
completely empty. I KNOW the file exists (because it is created about 2
lines before that) so HOW am I going wrong??

Help very much appreciated!


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About