0

当我使用 RNFetchBlob 时,单击上传按钮后应用程序将关闭当我无法使用 RNFetchBlob 时,将出现(Promise Unhandled Promise reject id:0)警告我正在使用模拟器 iPhone 11 并在 IOS 上工作,我的服务器是 000webhost .com'''

import RNFetchBlob from 'rn-fetch-blob';
uploadPic=()=>{
// alert('ddf');
RNFetchBlob.fetch('POST', 'https://drivingaidweb.000webhostapp.com/backend/image.php', {
Authorization : "Bearer access-token",
otherHeader : "foo",
'Content-Type' : 'multipart/form-data',
}, [
// element with property filename will be transformed into file in form data
{ name : 'image', filename : 'avatar.png', data: this.state.pic}
]).then((resp) => {
console.log(resp);
alert('your image uploaded successfully');
this.setState({avatarSource:null})
})
}
4

0 回答 0