请帮忙!尝试使用AngularFireStorage上传文件时出现错误,即使我已经在具有Firebase身份验证的应用程序上被识别
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
}
}
我的上传功能是
upload(event){
this.ImgError = "";
const id = event.target.files[0].name;
this.ref = this.afStorage.ref(id);
var ImgType = event.target.files[0].type.split('/')[0];
if(ImgType !== 'image') {
this.ImgError = "Désolé, invalide image";
return;
}
if(event.target.files[0]){
this.imagePath = '../../../assets/img/loading.gif';
this.ref.put(event.target.files[0])
.then(snapshot => {
return snapshot.ref.getDownloadURL(); // Will return a promise with the download link
})
.then(downloadURL => {
this.imagePath = downloadURL;
return downloadURL;
})
.catch(error => {
this.ImgError = "Une Erreur lors de la téléchargement de l'image";
});
}
}
我得到的错误
{ "error": { "code": 403, "message": "Permission denied. Could not perform this operation" } }