尝试将文件(如图片)上传到Firebase存储时出错。这很奇怪,因为我有另一个组件可以做得很好。这是我的代码:
file: File;
Upload() {
//Create reference to Firebase Storage
let storageRef = firebase.storage().ref('Uploads');
const metadata = {'contentType': this.file.type}
//Send update to Firebase Storage
storageRef.put(this.file, metadata);
}
fileListener(event) {
this.file = event.target.files[0];
this.upload();
}