Clear questions and runnable code
get the best and fastest answer
File upload w/WWW::Mechanizeby jkenneth (Pilgrim)
|on Oct 30, 2003 at 13:54 UTC||Need Help??|
jkenneth has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to use Mech to automate a file upload, however I'm seeing some odd behavior. When I execute the upload via the browser the params are:
Content-Disposition: form-data; name="file"; filename="file.1" Content-Type: application/octet-stream
However via Mech they send:
Content-Disposition: form-data; name="file"; filename="/tmp/file.1" Content-Length: 1056 Content-Type: application/x-troff-man
While reading the docs I found how to do it using HTTP::Request::Common, so after digging I tried to get the following to work:
Unfortunately, this causes the filename to become an array reference.
I tracked down the name to HTML::Form::FileInput where it has a reference to a 'legacy' section of code, which when I added
fixed the issue.
Is there another way to do this using WWW::Mechanize? I'd rather not have my change get whacked if someone decides to update LWP in the future.