kut*_*rie 12 multipartform-data fetch react-native
我的代码:
const file = {
uri: this.state.imageSource,
name: this.state.imageName,
type: "image/jpg"
}
const data = new FormData();
data.append("file", file);
fetch(config.server + "/upload", {
method: "POST",
body: data
})
.then(res => res.json())
.then(responseData => {
alert(JSON.stringify(responseData));
})
.catch(err => {
alert(err);
});
Run Code Online (Sandbox Code Playgroud)
没有FormData代码不显示错误.我应该怎么做才能解决?在android上调试.
kut*_*rie 11
该错误是因为我将URL作为数组传递,但是它需要一个字符串。
归档时间: |
|
查看次数: |
19368 次 |
最近记录: |