将图像上传到Firebase存储后,我无法从存储快照下载图像URL。
let snap;
this.selectedFiles = event.target.files;
const file = this.selectedFiles.item(0);
this.currentFileUpload = new Fileup(file);
this.userService.pushFileToStorage(this.currentFileUpload, this.progress).on(firebase.storage.TaskEvent.STATE_CHANGED,
(snapshot) => {
// in progress
this.loaded = true;
snap = snapshot as firebase.storage.UploadTaskSnapshot;
},
(error) => {
// fail
console.log(error);
},
() => {
// success
console.log('in complete url' + snap.downloadURL);
this.uploadedfile = snap.downloadURL;
this.loaded = false;
});
}