- 论坛徽章:
- 3
|
20可用积分
本帖最后由 grshrd49 于 2013-10-15 16:05 编辑
网上实在找不到相关的帖子,cpan上也找不到灵感,感觉不是上传格式写错了就是其他啥问题。总之用jmeter做的上传脚本正常运行,改用perl写就不行了,有大牛来给诊脉不?
这个是页面提交的post表单中的其中一块
改了好好多次了,普通的请求数据服务器都收到了,但是文件上传这块服务器始终没有收到,返回也没有任何错误!
有人对post请求有深入了解的没?
- POST data:
- --rqZkSQWTz_5hfkhgvH8r6garI7hGxw
- Content-Disposition: form-data; name="myFile"; filename="316x250.png"
- Content-Type: image/png
- Content-Transfer-Encoding: binary
- <actual file content, not shown here>
- --rqZkSQWTz_5hfkhgvH8r6garI7hGxw--
复制代码 我的代码片段
- ######
- #创建survey_title
- ######'C:\Users\Public\Pictures\testPic\316x250\316x250.png'
- open MF,"316x250.png";
- my $read;
- while(<MF>){
- $read .= $_;
- }
- close MF;
- #print @readfile;
- $return_json = $ua->post("$base_url/survey/a/editSurvey",
- {
- paperImage=>'',
- surveyTitle=>'perlscriptest2',
- surveyDesc=>'descperl',
- },
- myFile=>$read,
- filename=>"316x250.png",
- 'Referer'=>"$base_url/survey",
- 'Content-Type'=>"multipart/form-data;",
-
- )->content;
- my $surveyid;
- $surveyid = $1 if($return_json =~ /"surveyId":"(\d+)"/);
- print "surveyid = $surveyid\n";
- print "editSurvey - $return_json\n";
- print FF "editSurvey - $return_json\n";
复制代码 |
|