【发布时间】:2020-03-06 04:28:17
【问题描述】:
首先我创建一个 blob 文件
RNFetchBlob.fs.readFile(localImgUrl2, 'base64')
.then(base64ImageStr => Blob.build('image.png', base64ImageStr, { type: 'image/png;BASE64' }))
......然后我尝试上传到firebase
.then((data) => {FBStorageRef.put(data, { contentType: mime })})
...但它给了我错误
Firebase Storage: Object 'profilePics/image.png' does not exist
我相信它是我的FBStorageRef,它有一个牛肉......我的云存储完全是空的,我想创建一个名为 profilePics 的文件夹......以及我想要的文件调用 image.png
const FBStorageRef = Firebase.storage().ref('/profilePics/image.png');
上面写着profilePics/image.png doe not exist,这很真实.....但这正是我想正确上传它的原因:)
【问题讨论】:
-
嘿詹姆斯,我使用 Firebase 存储来保存图像,这样对吗?我只是从选择器中获取照片 URI 并将其作为图像“.jpg”保存到 firebase!
-
是的@hongdevelop 我读过这篇文章 - 不幸的是没有帮助......如果你将我的代码与文章进行比较,你会发现它非常接近。但是我觉得这个问题只与将图像上传到 Firebase 相关.....不要认为使用 rn-fetch-blob 的代码有什么问题
-
你好詹姆斯,你检查过“规则”部分吗?你有什么配置?也许是权限或无效配置:)
-
我做到了,是的 - 为开发人员设置了规则,因此任何人都可以读/写
标签: firebase react-native firebase-storage