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();