I'm getting an error stating that the upload was cancelled by the user and I'm getting three errors from a single upload in the console (all the same error from firebase storage when uploading a file. I cannot see how, within the code that a cancellation is being made (assuming that since it stated that the its the being cancelled by the user then it is within the code.
startUpload(event: FileList, item:string) {
// The File object
const file = event.item(0);
console.log(item);
// Client-side validation example
if (file.type.split('/')[0] !== 'image') {
console.error('unsupported file type')
return;
}
// The storage path
const path = `test/${new Date().getTime()}_${file.name}`;
// Totally optional metadata
const customMetadata = { user: item };
// The main task
this.uploadStatus = 'inprogress';
this.task = this.storage.upload(path, file, { customMetadata })
const fileRef = this.storage.ref(path);
// Progress monitoring
this.percentage = this.task.percentageChanges();
this.snapshot = this.task.snapshotChanges().pipe(
tap(snap => {
if (snap.bytesTransferred === snap.totalBytes) {
// Update firestore on completion
this.db.collection('photos').add( { path, size: snap.totalBytes });
this.uploadStatus = "finished";
}
}),
finalize(()=>{
this.downloadURL = fileRef.getDownloadURL();
console.log("Final");
})
);
}
The full error from chrome console : "storage/canceled" code_ : "storage/canceled" message : "Firebase Storage: User canceled the upload/download." message_ : "Firebase Storage: User canceled the upload/download." name : (...) name_ : "FirebaseError" serverResponse : null serverResponse_ : null
Firebase storage : Showing some of the uploads working (even though I get the error) :