我正在尝试将Blob图像发送到服务器,但是本机反应是显示错误网络失败错误。
get_data = async () => {
let file = new FormData();
fetch("https://jzzqf.sse.codesandbox.io/", {
method: "POST",
headers: {
"Content-Type": "multipart/form-data; charset=utf-8",
//"Content-Type": "text/html; charset=utf-8",
"Access-Control-Allow-Origin": "*"
},
mode: "no-cors",
body: file
})
.then(function(response) {
alert(response);
})
.catch(function(error) {
alert(error);
});
};
切换您的然后处理诺言拒绝
.then(response =>
{
alert(response);
}, reject => {
// handle reject here
})