in reply to WWW::Mechanize issue

BTW, HTML::Form objects also have a click() method, which returns an HTTP::Request object (in contrast to $mech->click(...), which returns an HTTP::Response object). And the HTTP::Request object has an as_string() method, that can be used to debug such things without doing tcpdumps (or even actually sending the request). For example:

use HTML::Form; my $html = <<'EOHTML'; <html> <body> <form action="http://localhost/" method="POST" enctype="multipart/form +-data"> <input type="file" name="file_name" value="test.csv" /> <input type="Submit" name="submit" value="Submit" label="Sumbit" /> </form> </body> </html> EOHTML my $form = HTML::Form->parse($html, "/"); # that would be something like $form = $mech->current_form() in WWW::M +echanize context my $input = $form->find_input("file_name"); $input->headers(content_type => "application/vnd.ms-excel"); my $req = $form->click(); print $req->as_string();

which would output (with test.csv containing the "foo;bar;..."):

POST http://localhost/ Content-Length: 219 Content-Type: multipart/form-data; boundary=xYzZY --xYzZY Content-Disposition: form-data; name="file_name"; filename="test.csv" Content-Type: application/vnd.ms-excel foo;bar;baz 1;2;3 --xYzZY Content-Disposition: form-data; name="submit" Submit --xYzZY--

(commenting out the $input->headers(...), you'd get the default "Content-Type: text/plain" for test.csv instead...)