use HTML::Form; my $html = <<'EOHTML';
EOHTML my $form = HTML::Form->parse($html, "/"); # that would be something like $form = $mech->current_form() in WWW::Mechanize context my $input = $form->find_input("file_name"); $input->headers(content_type => "application/vnd.ms-excel"); my $req = $form->click(); print $req->as_string(); ####
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--