Skip to content
This repository has been archived by the owner on Feb 27, 2022. It is now read-only.

How do I save image/video to gallery of the device? #69

Open
ManigandanRaamanathan opened this issue Feb 20, 2020 · 5 comments
Open

How do I save image/video to gallery of the device? #69

ManigandanRaamanathan opened this issue Feb 20, 2020 · 5 comments

Comments

@ManigandanRaamanathan
Copy link

ManigandanRaamanathan commented Feb 20, 2020

How do I save image/video to gallery of the device. Currently its saving default into the app folder. via the sample code from readMe:-
destination: ${RNBackgroundDownloader.directories.documents}/file.jpeg

@eramudeep
Copy link

having same confusion.

@julitroalves
Copy link

Same issue!

@aftabaminzoobiapps
Copy link

Here is for IOS .

const attachToTask = (task, filePath) => { task.begin(expectedBytes => { produce(draft => { }); }).progress(percent => { produce(draft => { }) }).done(async() => { try { CameraRoll.save(filePath, {'type':'video','album':'VideoDownloader'}) .then(() => { Alert.alert( Video Saved`,
'Video Saved Successfully',
[{text: 'OK',}],
{cancelable: false},
);
}).catch(err => {
Alert.alert(
'Save remote Image',
'Failed to save Image: ' + err.message,
[{text: 'OK', }],
{cancelable: false},
);
})
} catch (e) {
console.error(e);
}

             delete idsToData[task.id];
              setState(produce(draft => {
                delete draft.downloadsData[task.id];
                 draft.downloads.splice(draft.downloads.indexOf(task.id), 1);
                 }));
              AsyncStorage.setItem('idsToData', JSON.stringify(idsToData))
          }).error(err => {
              setState(produce(draft => {
                delete draft.downloadsData[task.id];
                draft.downloads.splice(draft.downloads.indexOf(task.id), 1);
           }));
                 console.error(`Download ${task.id} has an error: ${err}`);
                  delete idsToData[task.id];
                  AsyncStorage.setItem('idsToData', JSON.stringify(idsToData))
          });
      }
   `

@AnkitStar761
Copy link

Any update on this ? facing same issue to save file in gallary.

@aftabaminzoobiapps
Copy link

Any update on this ? facing same issue to save file in gallary.

Avove the solution for save to galley on IOS. with android you can use a=rn-fetch-blob

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants