Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect filename for form submission of file not from filesystem #198

Closed
spazm opened this issue May 8, 2017 · 0 comments · Fixed by #347
Closed

Incorrect filename for form submission of file not from filesystem #198

spazm opened this issue May 8, 2017 · 0 comments · Fixed by #347

Comments

@spazm
Copy link
Contributor

spazm commented May 8, 2017

Eckankar reported on Oct 3, 2011

As far as I can read from the WWW::Mechanize documentation (http://search.cpan.org/~jesse/WWW-Mechanize-1.70/lib/WWW/Mechanize.pm#%24mech-%3Esubmit_form%28_..._%29), you can do the following to submit a file from a string:

{{{
$mech->submit_form(
    fields => {
        'UploadedFile' => [[ undef, 'test2.txt', Content => $content ], 1],
    }
);
}}}

This should submit a file with name text2.txt, containing the text in $content (in this case, 'The file is a lie.').

The request failed with an internal server error, however, so I examined the request that was sent, and found this:

{{{
--xYzZY
Content-Disposition: form-data; name="UploadedFile"; filename="ARRAY(0x9567570)"

The file is a lie.
--xYzZY
}}}

That is clearly not the filename I specified, so it would seem that either the documentation is wrong, or the module is bugged here.

The same thing happens if I use with_fields instead of fields.

This is using WWW::Mechanize 1.70 from CPAN on Linux.


Details

Imported from Google Code issue 218 via archive

  • Type: Defect
  • Date: Oct 3, 2011
  • Reporter: Eckankar
  • Owner: ----
  • Priority: Medium
  • Status: New
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant