5 AFN中两种POST数据的方式的区别

5 AFN中两种POST数据的方式的区别_第1张图片

一般不是上传的post用application/x-www-form-urlencoded形式,它的body一般是

title=test&sub%5B%5D=1&sub%5B%5D=2&sub%5B%5D=3这种的


而上传用的表单multipart/form-data的body则是下面这种

Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryrGKCBY7qhFd3TrwA

------WebKitFormBoundaryrGKCBY7qhFd3TrwA

Content-Disposition: form-data; name="text"

title

------WebKitFormBoundaryrGKCBY7qhFd3TrwA

Content-Disposition: form-data; name="file"; filename="chrome.png"

Content-Type: image/png

PNG ... content of chrome.png ...

------WebKitFormBoundaryrGKCBY7qhFd3TrwA--

第一张图是application/x-www-form-urlencoded,第二张图是multipart/form-data


5 AFN中两种POST数据的方式的区别_第2张图片

你可能感兴趣的:(5 AFN中两种POST数据的方式的区别)