itinance / itinance/react-native-fs
RNFS.uploadFiles [Error: unexpected end of stream] framesToPop: 1, code: 'EUNSPECIFIED'
- Dominant language
- C++
- Stars
- 5k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
I tried it on android emulator, I am using the sample upload code and it return
`[Error: unexpected end of stream] framesToPop: 1, code: 'EUNSPECIFIED'`
This is the code I am using
```
async uploadImageReq(){
var url = this.API_BASE_URL + '/api/addimages/'
var uploadBegin = (response) => {
var jobId = response.jobId;
console.log('UPLOAD HAS BEGUN! JobId: ' + jobId);
};
var uploadProgress = (response) => {
var percentage = Math.floor((response.totalBytesSent/response.totalBytesExpectedToSend) * 100);
console.log('UPLOAD IS ' + percentage + '% DONE!');
};
console.log('check url', url, files)
return await RNFS.uploadFiles({
toUrl: url,
files: files,
method: 'POST',
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer ' + this._sessionToken,
'Connection': 'close'
},
fields: {
'hello': 'world',
},
begin: uploadBegin,
progress: uploadProgress
}).promise.then((response) => {
console.log('result', response)
return response
if (response.statusCode == 200) {
console.log('FILES UPLOADED!'); // response.statusCode, response.headers, response.body
} else {
console.log('SERVER ERROR');
}
})
.catch((err) => {
if(err.description === "cancelled") {
// cancelled by user
}
console.log('ERROR',err);
})
}
```
Should be same code as sample code on the documentation. it stop at
console.log('UPLOAD HAS BEGUN! JobId: ' + jobId);
then error
> [Error: unexpected end of stream] framesToPop: 1, code: 'EUNSPECIFIED'
Any idea What cause this error?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.