Vydia / react-native-background-upload

Upload files in your React Native app even while it's backgrounded. Supports Android and iOS, including camera roll assets.
MIT License
723 stars 330 forks source link

How to get the upload progress for each file during multiple image uploading? #209

Open SalihZinaty opened 4 years ago

SalihZinaty commented 4 years ago

I'm mapping through images and uploading them from a Realm DB. when uploading two images, the images upload progress sync to each other instead of running separately.

Upload.getFileInfo(finalPath).then(metadata => { //console.log('image name of file', image.file_name) Upload.startUpload(options) .then(uploadId => { console.log( Upload started with options: ${JSON.stringify(options)}, ); { Upload.addListener('progress', uploadId, data => { console.log(Progress of ${uploadId}: ${data.progress}%); realm.write(() => { image.upload_progress = data.progress / 100; }); }); })} what can I do to make every image take it's own progress? thanks!

reime005 commented 4 years ago

the uploadId should be there to differentiate between uploads

SalihZinaty commented 4 years ago

the uploadId should be there to differentiate between uploads

Can you tell me where to put it? Because the progress listener is inside the then of uploadId Thanks!

reime005 commented 4 years ago

can you provide a bigger/formatted example?