Where is FileSystem.documentDirectory?

I’m working on a camera app using camerja as a template, and after testing it some on my android phone, I’d like to find the pictures I took, but they don’t appear anywhere in my phone’s gallery. I’m trying to see if I can track them down in the file explorer, but I have no idea where FileSystem.documentDirectory actually is.

Where does FileSystem.documentDirectory lead? How can I save the pictures I take so that they’re accessible in the gallery?

documentDirectory is just a string, you can display or log it to see where things are going: https://snack.expo.io/B1kZNrTQM

1 Like

The odd thing is, it seems to be pointing to a folder that doesn’t exist on my phone. Does running it through the expo app and not as a standalone app mean it doesn’t save anything?

1 Like

Hey there! Photos will be saved in the documentDirectory when running through the Expo app, but you cannot access Expo’s documentDirectory through other apps on your phone - this is just part of the Android OS. What you may want to do is use the React Native CameraRoll API to copy your photos to the phone’s gallery - see https://facebook.github.io/react-native/docs/cameraroll.html#savetocameraroll . Hope this helps!

EDIT July 2018: I noticed this link seems to be popular, so just wanted to mention here that we now have the Expo.MediaLibrary API which can do the same thing but has a lot more power and flexibility. We currently recommend using this instead of React Native’s CameraRoll. Docs here: MediaLibrary - Expo Documentation

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.