In React-Native app how can i upload an image from user' device to Firebase storage? I'm doing like:
var file = {
uri: 'file:///Users/...../LONG_PATH/....../Documents/images/name.jpg'
}
var storageRef = this.firebase.storage().ref();
var uploadTask = storageRef.child('images/' + file.name).put(file);
But it throws an error:
Possible Unhandled Promise Rejection (id: 0):
Firebase Storage: Invalid argument in
put
at index 0: Can't find variable: Blob
In React-Native app how can i upload an image from user' device to Firebase storage? I'm doing like:
var file = {
uri: 'file:///Users/...../LONG_PATH/....../Documents/images/name.jpg'
}
var storageRef = this.firebase.storage().ref();
var uploadTask = storageRef.child('images/' + file.name).put(file);
But it throws an error:
Share Improve this question edited Jun 28, 2017 at 8:40 AL. 37.8k10 gold badges146 silver badges285 bronze badges asked Jul 17, 2016 at 12:35 Ivan ChernykhIvan Chernykh 42.2k13 gold badges136 silver badges148 bronze badgesPossible Unhandled Promise Rejection (id: 0):
Firebase Storage: Invalid argument in
put
at index 0: Can't find variable: Blob
2 Answers
Reset to default 4In this post, software engineer said:
React Native does not support the File and Blob types, so Firebase Storage uploads will not work in this environment. File downloads do work however.
But I found this module wich can transform file to blob types. Maibe can help in your solution
I found this, hopefully this helps. Functional React-Native with Firebase storage Example