Topic: uploadInput: retry same file after error (MDB4)
Expected behavior
After sending a file fails, you should be able to retry sending the same file without selecting it again.
Actual behavior
After the endpoint returns an error, uploadInput doesn't emit again unless you select the file again
Resources (screenshots, code snippets etc.)
Basic example code at the docs: https://mdbootstrap.com/docs/b4/angular/forms/file-input/#basic-example
and this:
startUpload(): void {
const event: UploadInput = {
type: 'uploadAll',
url: 'your-path-to-backend-endpoint',
method: 'POST',
data: { foo: 'bar' },
withCredentials: true
};
//COMENTING THIS PREVENTS FROM RE-TRYING, but I don't want to clear the files if there's an error
//this.files = [];
this.uploadInput.emit(event);
}
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
Answered
Specification of the issue
- User: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: MDB4 15.0.0
- Device: Windows
- Browser: Chrome
- OS: Windows
- Provided sample code: No
- Provided link: Yes
Tags
Related topics
Arkadiusz Idzikowski staff commented 2 years ago
Could you please provide more information on how to reproduce this problem step by step? Do you just start uploading and click the 'upload' button again without any changes after receiving an error from the server?
akrolis pro commented 2 years ago
Yes, that's the case. No change, just click upload again.
The only code difference with the docs is commenting the line this.files=[]; because it shouldn't clear the files if there's an error.
Arkadiusz Idzikowski staff commented 2 years ago
Thank you. I added that to our to-do list and we will take a closer look at this problem. I'm afraid there is no easy workaround for now and we will need to fix that on our end.