关于文件上传遇到的问 no multipart boundary was found

it2022-05-05  108

 

 

先补点基础知识:https://imququ.com/post/four-ways-to-post-data-in-http.html

image.png

boundary:边界数据是以multipart/form-data来编码以boundary开始内容描述回车字段具体内容如果是文件还要包含文件名和文件类型以--boundary--结束

问题描述

image.png

image.png

image.png

image.png

解决方案:You shouldNEVERset that header yourself. We set the header properly with the boundary. If you set that header, we won't and your server won't know what boundary to expect (since it is added to the header). Remove your custom Content-Type header and you'll be fine,也就是取消自己设置Content-Type就好了

最新回复(0)