Reinier Post <[EMAIL PROTECTED]> writes:
> On Mon, Aug 28, 2000 at 10:58:52PM +0200, Gisle Aas wrote:
> > Ian Duplisse <[EMAIL PROTECTED]> writes:
> >
> > > I am uploading files via HTTP::Request::Common::POST, but would like
> > > to modify the data that is actually uploaded to the webserver "on the fly",
> > > such as with a search and replace. How can that be done, short of making a
> > > copy of my original file that has the desired changes?
> >
> > Something like this should work:
> >
> > #!/usr/bin/perl
> >
> > use HTTP::Request::Common qw(POST);
> >
> > my $file = `cat stuff.txt`; # slurp a file
> > $file =~ s/foo/bar/g; # modify it
> >
> > my $req = POST('http://foo.com/',
> > Content_Type => 'form-data',
> > Content => [ foo => $bar,
> > file => [ undef, "stuff.txt",
> > Content_type => "text/plain",
> > Content => $file,
> > ],
> > ],
> > );
> >
> > print $req->as_string;
> >
> > use LWP::UserAgent;
> > $ua = LWP::UserAgent->new;
> > my $res = $ua->request($req);
> > __END__
>
> This is incompatible with the file upload used by my Netscape 4.7
> on Win98 browser, as understood by HTTP::File::upload. I.e. the above
> script will result in empty upload results with HTTP::File::upload at the
> receiving end, bcause the file content is transmitted in a different way.
>
> Does LWP also support that other method (multi-part/form-data, every form
> attribute being a separate part)?
I don't understand. This is multi-part/form-data. What is wrong with
it?
Regards,
Gisle