admin管理员组文章数量:1310178
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
本文标签: javascriptUploading image from ReactNative app to Firebase storageStack Overflow
版权声明:本文标题:javascript - Uploading image from React-Native app to Firebase storage - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741846979a2400836.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论