请问如何用WinInet送POST命令上传图片,将相应的数据提交服务器,并读取返回结果? 急?

解决方案 »

  1.   

    把下面的字符串s加在post语句的后面发送即可
    inter="------------------------------7d2256155c02de";
      
    s="--"+inter+#13#10+"Content-Disposition: form-data; name=\"image_tmp\"; filename=\"pathto\img.jpg\"\r\nContent-Type: image/jpg\r\n+文件内容+"\r\n--"+inter+"--\r\n";
      

  2.   

    上传 Access 数据库文件的也可以给分100
      

  3.   

    我给你一个上传文件的TCP抓包文件,你自己研究,如何?
    POST /33143/upload.php HTTP/1.1
    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*
    Referer: http://www.cneme.com/33143/upload.php
    Accept-Language: zh-cn
    Content-Type: multipart/form-data; boundary=---------------------------7d3201258708a0
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
    Host: www.cneme.com
    Content-Length: 8283
    Connection: Keep-Alive
    Cache-Control: no-cache
    Cookie: PHPSESSID=d95c40fd9945fac6a279636026f64273?  P 9 安AV? 郘=鉲 郘 , E ?]@ €%? A蔱 9 P-$C鶹缐 PH? -----------------------------7d3201258708a0
    Content-Disposition: form-data; name="MAX_FILE_SIZE"409600000
    -----------------------------7d3201258708a0
    Content-Disposition: form-data; name="userfile[]"; filename="C:\Documents and Settings\donald\My Documents\My Pictures\railcom.gif"
    Content-Type: image/gifGIF89a?( ? 骀缂冀們吚览卩轷鼹螋?(W7tA丅n?e朥r標皱臆楣九捭?>?=?1j1h&QB?<€<;~:|9{9y8w7u0f/e-aA?@???>?=?=?遦 亨BC?w"s┿+事畝 矦s$詌騐甡D躃繞 ?樹B縕u咀偒? 紁 $\
    ?4?p@#Px#0$p€!PX 裶u?靯G?堾(?s?s<?,噑/?2w?J(
     eR揁?at 篳 ??+婐;ⅱ.鋻 ?L
    ?\?綻U澿?YWz?_€M;?A?X m??啡?0 ;
    -----------------------------7d3201258708a0
    Content-Disposition: form-data; name="userfile[]"; filename=""
    Content-Type: application/octet-stream
    -----------------------------7d3201258708a0
    Content-Disposition: form-data; name="userfile[]"; filename=""
    Content-Type: application/octet-stream
    -----------------------------7d3201258708a0
    Content-Disposi<   9 P 犐aV? 郘 , 郘=鉲 E  (鞷@ 9櫘蔱
     A P 9V缐 -$`VP|?m        <   9 P €qV? 郘 , 郘=鉲 E  (鞹@ 9櫖蔱
     A P 9V缐 -$c鶳|三?       ?  P 9 €qV? 郘=鉲 郘 , E  ?d@ €+B
     A蔱 9 P-$c鶹缐 P墍  tion: form-data; name="submit"开始上传
    -----------------------------7d3201258708a0--
    ?  9 P ?zV? 郘 , 郘=鉲 E 皂U@ 9?蔱
     A P 9V缐 -$dUP|華  HTTP/1.1 200 OK
    Date: Wed, 30 Jul 2003 05:38:42 GMT
    Server: Apache/1.3.22 (Unix) PHP/4.0.6
    X-Powered-By: PHP/4.0.6
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: private, max-age=10800, pre-check=10800
    Last-Modified: Mon, 19 May 2003 12:14:12 GMT
    Keep-Alive: timeout=15, max=100
    Connection: Keep-Alive
    Transfer-Encoding: chunked
    Content-Type: text/html; charset=gb2312762
    文件&lt;railcom.gif&gt;成功上传为&ltrailcom0.gif&gt<br> <!--script>