This repository was archived by the owner on Mar 16, 2019. It is now read-only.
This repository was archived by the owner on Mar 16, 2019. It is now read-only.
upload finish callback #367
Open
Description
Is there any callback when upload has been finished? Basically, when I uploaded a file, i would like to show file has been uploaded. Unfortunately, the response from the server doesn't come after 5 seconds.. So we cannot use also the download progress callback.
Sample Code:
RNFetchBlob.fetch('POST', 'http://'+ SERVER_PORT +'/sfdsdf/webapi/videos', {
//... some headers,
'Content-Type' : 'octet-stream'
}, [
{ name: 'file', filename: 'dsfdsfsf.mp4', data: RNFetchBlob.wrap(this.props.videoSource) },
{ name: 'title', data: this.props.title },
{ name: 'description', data: this.props.description }
])
// listen to upload progress event, emit every 250ms
.uploadProgress({ interval : 100 },(written, total) => {
console.log('uploaded', written / total)
})
// listen to download progress event, every 10%
.progress({ count : 10 }, (received, total) => {
console.log('progress', received / total)
})
.then((response) => {
console.log(response);
// bring back the view to list
this.props.uploadVideoSuccess();
})
.catch((err) => {
console.log('error occured');
console.log(err);
// ...
});
My console logs shows 99% upload done (even though file was uploaded successfully),, but is there another callback that will let me know my upload is 100%?
http://imgur.com/a/MlaUx
Below are my versions:
"react-native": "0.42.3",
"react-native-fetch-blob": "^0.10.5",