フェッチを使用してフォームデータファイルをアップロードするときに、コンテンツタイプをランダムに設定しないでください
let opts = {
method: "POST",
body: formData,
headers: {
// Content-Type:'application/x-www-form-urlencoded'不要随便设置
},
};
let url = "http://localhost:3000/upload";
fetch(url, opts)
.then((res) => res.text())
.then((data) => console.log(data));
この記事の内容を惨めなものに設定するために、最初の記事のBaiduの「fetch」+「formdata」キーワードに従わないでください/(ㄒoㄒ)/ ~~