Table of contents
Open Table of contents
1. 使用Fetch上传图片时报错Error: no multipart boundary was found
删除指定的Content-Type,浏览器会自动设置
const formData = new FormData()
formData.append('file', file, 'a.image')
fetch('https://api.aaa.com',
{
method: 'POST',
headers: {
"Content-Type": "multipart/form-data" //delete
},
body: formData
}
)