Closed Parkjunwu closed 1 year ago
On Android, the following should copy an image to the system image storage.
// Produce an image file somehow, storing here:
const source = Dirs.CacheDir + '/img.jpg';
await FileSystem.cpExternal(source, 'img.jpg', 'images');
If you want more control over the destination, you could do something like:
import * as ScopedStorage from 'react-native-scoped-storage';
const targetDir = await ScopedStorage.openDocumentTree();
const target = AndroidScoped.appendPath(targetDir, 'img.jpg');
await FileSystem.cp(source, target);
Thank you for your comment!
Is this process also working right on IOS?
iOS has a different permissions model, which I unfortunately do not understand very well (when I have time, I plan to investigate further). Currently the way this library works, putting files in Dirs.DocumentDir
, and enabling UIFileSharingEnabled
and LSSupportsOpeningDocumentsInPlace
, will allow other apps to read files from this app.
From the documentation, https://github.com/react-native-cameraroll/react-native-cameraroll might be able to do what you intend.
Thank you very much!!
Hello!
I want to implement that user's local file or fetched file upload to application's local storage like android's scoped storage.
But I don't know well about upload to local storage.
I understand this library's documentation explanation like this library can only upload .txt file.
I want to know my understanding is right.
Can I upload media file to local storage like image, video file?
Thank you!