最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Uploading image from React-Native app to Firebase storage - Stack Overflow

programmeradmin0浏览0评论

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:

Possible Unhandled Promise Rejection (id: 0):

Firebase Storage: Invalid argument in put at index 0: Can't find variable: Blob

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 badges
Add a ment  | 

2 Answers 2

Reset to default 4

In 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

发布评论

评论列表(0)

  1. 暂无评论