Invalid WWW file name :: Mechanize submission

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?

+6
source share
1 answer

This is a bug in HTML :: Form. I reported this to the author.

At the same time, if you have HTML :: Form version 6.00, you can temporarily correct the situation by commenting on line 1442 in HTML / Form.pm format, which reads

 $old = $self->file unless defined $old; 
+2
source

Source: https://habr.com/ru/post/898482/


All Articles