<form method="post" action="/cgi-bin/luci/engineer/advanced/diagnostics/upgrade/"></code> " After I login, it changed to
The output as follows:<form method="post" action="/cgi-bin/luci/;stok=4DB4115975EF48FD742227 +BAD3580034/engineer/advanced/diagnostics/upgrade" enctype="multipart/ +form-data"></p> Note: there is a cache generated after login as follows: Set-Cookie: sysauth=ACA415DA69DD4170D34D2DDCE2B610F5; path=/cgi-bin/lu +ci/;stok=44F89C9B8E1EB34F9D379B5162763EAF Location: /cgi-bin/luci/;stok=44F89C9B8E1EB34F9D379B5162763EAF/enginee +r So I need to use the token when doing the upload. The source is follow by "zentaras" <code>#!/usr/bin/perl use warnings; use strict; use LWP::UserAgent; use HTTP::Cookies; use HTTP::Request::Common qw(POST); #test on plain http my $http_post = 'http://192.168.1.1/cgi-bin/luci/engineer/advanced/dia +gnostics/upgrade/'; my $http_user = 'engineer'; my $http_pass = 'ARC$eng&123'; my $file = 'rev1-54.zip'; &postHTTP(); sub postHTTP { my $ua = new LWP::UserAgent; $ua->protocols_allowed( [ 'http'] ); $ua->cookie_jar(HTTP::Cookies->new(file =>".cookies.txt",autos +ave => 1)); #setup request my $req = POST($http_post, Content_Type => 'multipart/form-data', Content =>[ file =>[ $file ], ], ); my $user = 'engineer'; my $pass = 'ARC$eng&123'; $req->authorization_basic($user, $pass); #do post my $response = $ua->request($req); if ($response->is_error()) { printf " %s\n", $response->status_line; print "http request error!\n"; } else { my $content = $response->content(); print "$content\n"; } if ( $response->is_success ) { print $response->as_string; }else { print $response->status_line; } }
... HTTP/1.0 200 OK Cache-Control: no-cache Vary: Accept Content-Type: text/html; charset=UTF-8 Expires: 0 Client-Date: Thu, 14 Jan 2010 10:27:27 GMT Client-Peer: 192.168.1.1:80 Client-Response-Num: 1 Content-Script-Type: text/javascript Link: </luci-static/ger/cascade.css>; media="screen"; rel="stylesheet"; type="text/css" Title: Test ... <form method="post" action="/cgi-bin/luci/engineer/advanced/diagnostics/upgrade/"> ...
Doesn't doing any uploading. the upload file is a 15M .Zip file. Any wiser can give me the solution? ThanksUpdate: I have tried another method please jump to topic:Control IE to upload file issue
In reply to Post Error (upload files) by owenhhs007
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |