有没有办法覆盖Firebase存储中的已保存文件? [英] Is there a way to overwrite a saved file in firebase storage?

查看:60
本文介绍了有没有办法覆盖Firebase存储中的已保存文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ionic 1 App处理个人资料图片.我正在寻找一种更新Firebase存储中文件的方法,以使下载链接保持不变. 是否有可能或通过其他任何方式达到要求?

I am dealing with profile pictures in my ionic 1 App. I am searching for a way to update a file in firebase storage such that the download link remains the same. Is it possible or any other way to achieve the required?

推荐答案

您无法更新文件并维护相同的公共下载链接-它是不同的文件,因此假设您可能要更改访问权限

You can't update the file and maintain the same public download link--it's a different file, so it's assumed that you might want to change the access permissions

只需重新获取URL并在更新后下载文件即可(它实际上是在上传时返回的元数据中返回的,因此您可以在更改后立即将其发送到其他应用,而无需单独获取URL) :

Just re-fetch the URL and download the file once it's been updated (it's actually returned in the metadata returned on upload, so you can send it to other apps right after you change it, no need to grab the URL separately):

var file = ... // use the Blob or File API
ref.put(file).then(function(snapshot) {
  var url = snapshot.downloadURL;
});

这篇关于有没有办法覆盖Firebase存储中的已保存文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆