Gisle Aas wrote,
> "petersm" <[EMAIL PROTECTED]> writes:
> 
> > I am new to LWP and WWW::Mech and have used them on a couple of
> > projects. I was wondering what is the best way to do a multipart
> > post (file upload) using LWP.
> 
> >From LWP you just do a post with something like:
> 
>   $ua->post('http://www.example.com',
>             content_type => 'form-data',
>             content => [
>                foo => 1,
>                file => ["foo.txt"],
>             ]);
> 
> More details available by reading the HTTP::Request::Common manpage.

Thanks Gisle. Great work BTW. Ok, so if I understand this correctly, if I want
to upload a file but I have the contents of that file in a scalar then I can
do something like this...

$ua->post('http://www.example.com',
    content_type => 'form-data',
    content => [
      foo => 1,
      file => [undef, '', $my_files_contents],
      ]);

Is this correct? Thanks,

Michael Peters
Venzia

Reply via email to