As far as I can read from WWW :: Mechanize documentation , you can do the following to send a file from a line:
$mech->submit_form( fields => { 'UploadedFile' => [[ undef, 'test2.txt', Content => $content ], 1], } );
This should send a file called text2.txt
containing the text in $content
(in this case, 'The file is a lie.'
).
Request error with internal server error, so I reviewed the submitted request and found the following:
--xYzZY Content-Disposition: form-data; name="UploadedFile"; filename="ARRAY(0x9567570)" The file is a lie. --xYzZY
This is clearly not the file name that I specified, so I'm wondering: am I doing something wrong, or is the module listening?
source share