var buffer = fs.readFileSync(’./icon/101.png’); var form = new FormData(); form.append(‘img’, buffer); fetch(‘https://api.xxx.cn/users/me/icon’, { method: ‘POST’, body: form, headers: { ‘Content-Type’: ‘multipart/form-data’, } }) .then(function (res) { //{ message: ‘NO FILE UPLOADED’, code: 12005 } return res.json(); }).then(function (json) { console.log(json); })
返回的数据提示没有可上传的图片? 但是我输出buffer 是可以有的。为什么呢?请教