HTTP POST上传文件的格式示范



POST /myweb/upload HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:20.0) Gecko/20100101 Firefox/20.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://localhost:8080/myweb/upload.jsp
Cookie: JSESSIONID=ED970C05E8B03443BB3C6E6C1B4276F9
Connection: keep-alive
Content-Length: 1535
Content-Type: multipart/form-data; boundary=---------------------------55673634719082275921521130938

-----------------------------55673634719082275921521130938
Content-Disposition: form-data; name="username"

sunmeng 
-----------------------------55673634719082275921521130938
Content-Disposition: form-data; name="file"; filename="test.txt"
Content-Type: text/plain

total 64 drwxrwxr-x 4 sunmeng sunmeng 4096 4月 5 13:56 components drwxr-xr-x 3 sunmeng sunmeng 4096 4月 13 23:45 Desktop drwxr-xr-x 2 sunmeng sunmeng 4096 4月 8 23:35 Documents drwxrwxr-x 2 sunmeng sunmeng 4096 4月 6 11:42 Ebook drwxr-xr-x 2 sunmeng sunmeng 4096 4月 6 22:04 Music -rw-rw-r-- 1 sunmeng sunmeng 548 4月 10 23:54 mydb.sql drwxr-xr-x 2 sunmeng sunmeng 4096 4月 5 00:41 Pictures drwxr-xr-x 2 sunmeng sunmeng 4096 3月 30 20:15 Public lrwxrwxrwx 1 sunmeng sunmeng 42 4月 13 23:47 shutdown -> /home/sunmeng/Soft/tomcat6/bin/shutdown.sh drwxrwxr-x 5 sunmeng sunmeng 4096 4月 13 23:40 Soft lrwxrwxrwx 1 sunmeng sunmeng 41 4月 13 23:45 startup -> /home/sunmeng/Soft/tomcat6/bin/startup.sh drwxr-xr-x 2 sunmeng sunmeng 4096 3月 30 20:15 Templates -rw-rw-r-- 1 sunmeng sunmeng 13 4月 10 23:43 test.sql -rw-rw-r-- 1 sunmeng sunmeng 0 4月 14 00:25 test.txt drwxrwxr-x 2 sunmeng sunmeng 4096 4月 5 13:56 Ubuntu One -rw-rw-r-- 1 sunmeng sunmeng 167 4月 11 23:45 userdb.sql drwxr-xr-x 2 sunmeng sunmeng 4096 3月 30 20:15 Videos drwxrwxr-x 7 sunmeng sunmeng 4096 4月 13 23:33 workspace drwxrwxr-x 6 sunmeng sunmeng 4096 4月 10 22:38 workspaceA 

-----------------------------55673634719082275921521130938--//此处有\r\n



注意:1.头部分的boundary有27个'-',其他部分有29个'-',最后结尾后面跟俩格'-';请求头部结束后后面跟一空行表示不再有请求,内容头和内容体之间有一空行,最后有一个空行

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值