Topic: File Input - how to use cancelUpload? (MDB4)

akrolis pro asked 1 year ago


In the examples for File Input (https://mdbootstrap.com/docs/b4/angular/forms/file-input/#basic-example) there's this function called cancelUpload:

cancelUpload(id: string): void {
  this.uploadInput.emit({ type: 'cancel', id: id });
}

I don't know exaclty what it does or what is the id parameter that needs. I'm trying to call it to cancel an ongoing upload but it does nothing.

In a standard http call I usually unsubscribe to cancel the call, but UploadInput doesn't work that way and I assumed that was what cancelUpload did (unsubscribe).

Any further explanation as to how to use that function or how to effectively cancel the upload would be great.

Thanks in advance


Arkadiusz Idzikowski staff commented 1 year ago

Did you add the id of the currently uploaded file as a cancelUpload parameter? All of the uploaded files should be stored in the files array. In case of any further problems with file id you can also try to use cancelAll event: this.uploadInput.emit({ type: 'cancelAll' });


akrolis pro commented 1 year ago

cancelAll worked. Thanks.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: MDB4 13.0.0
  • Device: Windows
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: Yes