$response = $mech->submit_form( with_fields => { 'filechooserelement' => [ [ $tmpfile, $uploadfile ], 1 ], ... , }, );