【发布时间】:2020-04-15 18:19:40
【问题描述】:
如何在将多个文件上传到 Firebase 存储后获取 url 数组。我正在使用下面的代码,但它返回元数据数组。
firebase.storage().ref().constructor.prototype.putFiles = function(files) {
var ref = this;
return Promise.all(files.map(function(file) {
return ref.child(file.name).put(file);
}));
}
// use it!
firebase.storage().ref().putFiles(files).then(function(metadatas) {
// Get an array of file metadata
}).catch(function(error) {
// If any task fails, handle this
});
【问题讨论】:
标签: reactjs firebase firebase-storage