>  기사  >  백엔드 개발  >  为何用Delphi程序写的POST不能下传图片

为何用Delphi程序写的POST不能下传图片

WBOY
WBOY원래의
2016-06-13 10:46:021012검색

为何用Delphi程序写的POST不能上传图片?
我用Delphi写了个POST,想实现自动上传的功能,但是就算我把整个提封包完全模拟下来,也不能成功提交图片,求高手帮忙解答!

以下是PHP的代码

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <?php //上传文件类型列表  $uptypes=array(      'image/jpg',      'image/jpeg',      'image/png',      'image/pjpeg',      'image/gif',      'image/bmp',      'image/x-png' );   $max_file_size=2000000;     //上传文件大小限制, 单位BYTE  $destination_folder="uploadimg/"; //上传文件路径   $imgpreview=0;      //是否生成预览图(1为生成,其他为不生成);  $imgpreviewsize=1/1;    //缩略图比例  ?>        <title>FileUpload</title>  <style type="text/css">  <!--  body  {       font-size: 9pt;  }  input  {       background-color: #66CCFF;       border: 1px inset #CCCCCC;  }  -->  </style>       
上传文件: 已经成功上传
"; if($imgpreview==1) { echo "
图片预览:
"; echo "\"图片预览:\r文件名:".$destination."\r上传时间:\""; } } ?>



以下是正常网页提交,和Delphi写的程序POST提交的截包
XML code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->POST /aa.php HTTP/1.1Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-silverlight, */*Referer: http://116.254.216.83/aa.phpAccept-Language: zh-cnContent-Type: multipart/form-data; boundary=---------------------------7dc38a1d60e20Accept-Encoding: gzip, deflateUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)Host: 116.254.216.83Content-Length: 37420Connection: Keep-AliveCache-Control: no-cache-----------------------------7dc38a1d60e20Content-Disposition: form-data; name="upfile"; filename="C:\Documents and Settings\Administrator\妗岄潰\Test\789_3.jpg"Content-Type: image/pjpeg??==================以上是网页提交截取的封包==========================================以下是Delphi程序提交截取的封包========================POST /aa.php HTTP/1.1Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-silverlight, */*Referer: http://116.254.216.83/aa.phpAccept-Language: zh-cnContent-Type: multipart/form-data; boundary=---------------------------7dcbbd440b68Accept-Encoding: gzip, deflateUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)Host: 116.254.216.83Connection: Keep-AliveContent-Length: 37630Cache-Control: no-cache---------------------------7dcbbd440b68Content-Disposition: form-data; name="upfile"; filename="D:\Test\789_5.jpg"Content-Type: image/pjpeg??<div class="clear">
                 
              
              
        
            </div>
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.