Get image size in bytes

I want to validate the image size to 2MB before upload. I tried to use FileSystem.getInfoAsync with the ImagePicker result.uri, but it doesn’t find the file…
Any solutions?

Hi! Per the ImagePicker docs:

The local image URI is temporary. Use Expo.FileSystem.copyAsync to make a permanent copy of the image.

Are you attempting to do this immediately after the image is returned, or are you saving the URI for later?

Hi there, im doing this immediatelly after the img is returned. I tried to make a copy with Expo.FileSystem.copyAsync, but it gives me a error saying that is undefined.
Strange, because, of the Expo.FileSystem, i can use only getInfoAsync(), all the other functions are ‘undefined’

What SDK version are you using?

version 15.0.0, but im trying to upgrade it to the last version, can it be the problem?

I’m not sure the FileSystem APIs you’re looking for are available on SDK 15. Can you try on a newer SDK?

I updated to the version 20.0.0 following the steps on the blog, but now its giving me the message:
undefined is not an object (evaluating ‘ReactInternals.ReactCurrentOwner’)

trying to update now all the versions of react-native, react, and expo, i forgot to update react and react-native before…

Updated to version 20.0.0, some warnings, but now it seems to run with no problems