http上传文件

来源:互联网 发布:pyqt5 windows 安装 编辑:程序博客网 时间:2024/05/22 13:57
一个典型的http上传协议头类似于这样:

   POST /public/upload.action HTTP/1.1
     ost: maiit.com:8088
     User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b5) Gecko/2008041514                  Firefox/3.0b5
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: en-us,en;q=0.5
    ccept-Encoding: gzip,deflate
    ccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 300
    Connection: keep-alive
    Referer: http://maiit.com:8088/public/up.html
    Content-Type: multipart/form-data;     boundary=---------------------------88739631214394723612117964652
    Content-Length: 3433
其中,boundary是文件分割符号,每个文件以如下字段开头
      
     -----------------------------88739631214394723612117964652
     Content-Disposition: form-data; name="file"; filename="hashtables.h"
     Content-Type: text/x-chdr
以如下字段结尾:
      
     -----------------------------88739631214394723612117964652
    Content-Disposition: form-data; name="uploadButton"

    up
    -----------------------------88739631214394723612117964652--