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

LWP::UserAgent Upload Woes.

Thread Next
From:
Stuart Low
Date:
January 1, 2002 04:41
Subject:
LWP::UserAgent Upload Woes.
Message ID:
005301c192c1$d6e28f40$3237a8c0@laptop
ARGH!

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->request($req)->as_string;
$ua = LWP::UserAgent->new;
$req = POST 'http://tgp.russiansubmitter.com/cgi-bin/psuploade.cgi',
 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!

Stuart


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About