I’ve been trying to upload an image using firebase, React Native and react-native-image-picker.
The data I get from the image picker is in base64 format and I don’t know how to actually upload it to my firebase storage because when I execute the following line :
var imageRef = storageRef.child("images/usersImages/" + global.userID + ".jpg")
uploadTask = imageRef.put(global.imageToUpload)
Nothing is executed after. Even if I put an alert right after.
My « file » variable contains that : 'data:image/jpeg;base64,' + response.data
I’ve also tried to put only the response.data but it’s not working.
From what I read last here, Firebase doesn't support uploading images as binaries from
react-native
. However, you can store the base64 encoded image directly in firebase. It would be like storing any other string in firebase. There is a limit ofless than 10 MB
though while storing image directly on firebase like this.