上传从相机单击的图像并尝试上传,但作为响应,获得的图像大小为0。
下面是我的React本机代码
var imagepath = {
uri: this.state.filepath.uri,
name: this.state.filename,
type: this.state.filetype
}
var frmdata = new FormData();
frmdata.append('name', this.state.name);
frmdata.append('email', this.state.email);
frmdata.append('photo', imagepath);
axios({
method: 'post',
url: apiContants.Main_Url + apiContants.REGISTERATION,
data: frmdata,
headers: {'Content-Type': 'multipart/form-data' }
})
.then(function (response) {
//handle success
console.log('ResponseRig = ', response);
_this.hideLoader();
if(response.data.status == 1){
_this.goToPayment();
}
ToastAndroid.show(response.data.msg,ToastAndroid.SHORT);
})
.catch(function (response) {
//handle error
_this.hideLoader();
console.log('ResponseErr =',response);
ToastAndroid.show("Registration failed",ToastAndroid.SHORT);
});
下载的图像成功上传。但是当我尝试使用任何设备上传从相机单击的图像时。它不起作用