返回上传到firebase的文件的下载URL [英] return the download URL of a file uploaded to firebase

查看:86
本文介绍了返回上传到firebase的文件的下载URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种简单的方法可以将文件的下载网址上传到Firebase?

Is there a simple way to get the download URL of a file uploaded to Firebase?

(我试过玩我的上传功能返回的快照,找不到任何东西......)

(I've tried playing around with the snapshot returned by my upload function and couldn't find anything...)

     fileref.put(file).then(function(snapshot){
     self.addEntry(snapshot);   
     ///  return snapshot.url???
     });


推荐答案

要从快照中获取默认创建的网址可以使用 downloadURL ,意思是 snapshot.downloadURL

To get the Url created by default from the snapshot you can use downloadURL, meaning snapshot.downloadURL.

请务必使用 .on('state_changed')这里的文档

这篇关于返回上传到firebase的文件的下载URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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