-2

在此处输入图像描述

我需要 Realtime firebase 数据库中文件的这种类型的URL(我在图片中显示)。我无法编写JavaScript代码

4

1 回答 1

0

如果您使用脚本上传,则需要从参考中获取下载 URL。这可以通过以下方式完成(使用 javascript 的 Firebase 网络方法)

// Put the file into storage
var uploadTask = storageRef.child('images/rivers.zip').put(file)
// catch the snapshot of storage upload and get download URL
.then(snapshot => snapshot.ref.getDownloadURL())
// send download URL to realtime database
.then((downloadURL) => {
    firebase.database().ref('files/' + FileID + '/url'.set(downloadURL);
    })
.catch(console.log());
于 2021-04-20T08:25:37.217 回答