output from IE is :The file uploaded may be of the wrong type or damaged. My question isuse Win32::IE::Mechanize; my $url = 'http://192.168.1.1/cgi-bin/luci/engineer/advanced/diagn +ostics/upgrade'; #my $username = 'engineer'; #my $password = 'ARC$eng&123'; my $file = 'C:\Documents and Settings\michaelhuang\Desktop\rev1-54 +.zip'; my $ie = Win32::IE::Mechanize->new( visible => 1); $ie->get( $url); $ie->form_number(4); $ie->set_fields( username => 'engineer', password => 'ARC$eng&123' ); $ie->submit(); $ie->form_number(4); $ie->set_fields( #filename=>'rev1-54.zip' image => $file, ); $ie->submit();
1.Why I can't submit this form to implement the upload?
2.I wanna use this script to control the IE to do the upload, need I need other model except Win32::IE::Mechanize?
3.In the Win32::IE::Mechanize source code, how to set up the argument of $mech->value( $name, $number ), does this method can help my script?
4.If I use other way to do the upload, I need to find the new URL for upload, which way is the easiest way to find the URL?(It can redirect to the new URL after I manually login, but failed to find using this script)
I am a newbie of Perl, I will appreciate for anyone give thread to me.Update: I have found the issue is in trace back in source of webpage. The type of input is "file", so I can't use submit_form with text inside.
In reply to Control IE to upload file issue by owenhhs007
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |