owenhhs007 has asked for the wisdom of the Perl Monks concerning the following question:

Hi, monks, I have a question about upload a big file.
use 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();
output from IE is :The file uploaded may be of the wrong type or damaged. My question is

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.

Replies are listed 'Best First'.
Re: Control IE to upload file issue
by marto (Cardinal) on Jan 18, 2010 at 16:10 UTC
      Sorry, I forget to update other two topics, in fact, I have tried there different ways to implement my script. Maybe I will close other two topics.

      Update: I have updated them.