summary
multipart 用于在http中高效上传文件
“multipart” or “form-encoded data” is a MIME type which contains multiple files.
优点
‘application/x-www-form-urlencoded’(在multipart之前用于文件上传的方式)需要在文件上传前encoding,multipart不需要
stream each part separately(多个文件,对每个文件支持单独流式传输)
样例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| POST /cgi-bin/qtest HTTP/1.1 Content-Type: multipart/form-data; boundary=2a8ae6ad-f4ad-4d9a-a92c-6d217011fe0f Content-Length: 514
--2a8ae6ad-f4ad-4d9a-a92c-6d217011fe0f Content-Disposition: form-data; name="datafile1"; filename="r.gif" Content-Type: image/gif
GIF87a.............,...........D..; --2a8ae6ad-f4ad-4d9a-a92c-6d217011fe0f Content-Disposition: form-data; name="datafile2"; filename="g.gif" Content-Type: image/gif
GIF87a.............,...........D..; --2a8ae6ad-f4ad-4d9a-a92c-6d217011fe0f Content-Disposition: form-data; name="datafile3"; filename="b.gif" Content-Type: image/gif
GIF87a.............,...........D..; --2a8ae6ad-f4ad-4d9a-a92c-6d217011fe0f--
|
reference