On Thu, 21 Sep 2000, Lillith Lesanges wrote:
> I'm trying to write a perl client that emulates submitting a form with the
> following fields: a text username, a text password, and a FILE type
> file. If I use a browser, the file gets MIME-encoded (and this is what
> the cgi-bin getting the submission expects).
I got a couple responses, but they don't seem to answer my question. For
one thing, I need to use the POST method, not a GET method. Also, I just
need to submit the form (and file), I don't need to get anything back.
Perhaps it will help if I post the code that I have so far. I have, of
course, changed some names to protect the innocent.
The file that gets saved by cgi-bin/saveprogramhere when I use this
program is very incorrect. If I just use a browser, the file is
correct. How do I make LWP use the correct MIME headers?
Lillith
-----------------------------------
#!/usr/bin/perl
use HTTP::Request::Common;
use LWP::UserAgent;
use CGI qw(header -no_debug);
my $URL = 'https://www/cgi-bin/saveprogramhere';
my $req = POST $URL,
Content_Type => 'form-data',
Content => [
user => 'usernamegoeshere',
pass => 'passwordgoeshere',
FILE => ['./binaryfilegoeshere'], # this file will be uploaded
];
my $res = LWP::UserAgent->new->request($req);
------------------------------------
Lillith Lesanges
Systems Administrator e: [EMAIL PROTECTED]
XpresscheX, Inc. v: 505-998-3141 x3712