【问题标题】:Upload image to firebase using react-native-image-picker使用 react-native-image-picker 将图像上传到 firebase
【发布时间】:2016-12-08 21:41:58
【问题描述】:

我一直在尝试使用 firebase、React Native 和 react-native-image-picker 上传图片。

我从图像选择器获得的数据是 base64 格式,我不知道如何将其实际上传到我的 firebase 存储,因为当我执行以下行时:

var imageRef = storageRef.child("images/usersImages/" + global.userID + ".jpg")
uploadTask = imageRef.put(global.imageToUpload)

之后什么都不执行。即使我马上发出警报。 我的«文件»变量包含:'data:image/jpeg;base64,' + response.data

我也尝试只放置 response.data,但它不起作用。

【问题讨论】:

    标签: javascript firebase upload react-native firebase-storage


    【解决方案1】:

    根据我上次阅读的here,Firebase 不支持从react-native 将图像作为二进制文件上传。但是,您可以将 base64 编码的图像直接存储在 firebase 中。这就像在 firebase 中存储任何其他字符串一样。 less than 10 MB 的限制虽然像这样直接在 Firebase 上存储图像。

    【讨论】:

      猜你喜欢
      • 2020-03-13
      • 2020-09-16
      • 1970-01-01
      • 1970-01-01
      • 2020-09-16
      • 2018-08-25
      • 2020-06-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多