Firebase Cloud Storage 下载网址与路径

标签 firebase firebase-storage

我是 Firebase 存储的新手,想知道最佳实践是什么。
我想将图像上传到 Firebase 云存储并返回一个下载 url,然后我将其存储到 firestore。下载地址是永久的吗?其他用户将从 Firestore 中读取以获取下载图像的 url。

但是当我想从 CloudStorage 中删除图像时,我只有下载 url 而没有文件路径。那我要删除它吗?

如果我存储文件路径,如何获取下载网址?

最佳答案

Is the download url permanent?



下载 URL 将一直有效,直到您撤销它。

I only have the download url but not the file path. So do I delete it?



你可以得到一个StorageReference从下载 URL 调用 FirebaseStorage.getReferenceFromUrl() (或您平台的等价物)。

If I store the file path instead, how to get the download url?



您可以创建 StorageReference对于带有 FirebaseStorage.getReference() 的路径,然后调用StorageReference.getDownloadUrl() .

关于Firebase Cloud Storage 下载网址与路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52252520/

相关文章:

android - 在 Android 上过滤 Firebase 数据库 DataSnapshot 子级

python - 如何获取上传文件的url?

firebase - 使用 Firebase 存储时未定义类 StorageReference

android - 如何在Android中压缩图像文件?

java - 我想从 firebase 存储中检索视频

基于 Firebase firestore 时间戳的安全规则

firebase - 用户 UUID 删除后是否会重新使用? (Firebase 身份验证)

javascript - Firebase .push() 抛出 'permission_denied' 错误

android - FirebaseAuth 为空

firebase - firebase 存储中的 mediaLink 和 SignedUrl 有什么区别