XHR异步上传文件报错: “the request was rejected because no multipart boundary was found”

来源:互联网 发布:佰笛手风琴 淘宝 编辑:程序博客网 时间:2024/05/22 05:01

js 使用异步上传文件时报错:

报错描述

解决方法:

图片描述

// 开始上传xhr.open("POST", self.url, true);// xhr.setRequestHeader("Content-Type","multipart/form-data");xhr.send(formData);

因为请求头的”Content-Type”会自动填充,不需要单独设置header,也就是说,多此一举了。

https://stackoverflow.com/questions/17415084/multipart-data-post-using-python-requests-no-multipart-boundary-was-found

阅读全文
0 0
原创粉丝点击