Topic: File Input upload error handling

kepner priority asked 4 years ago

**Expected behavior**

It should return the error message of the failed Upload Http call

**Actual behavior**

I can't find a way to handle the error callback.


I have implemented my own backend to be able to handle the file upload. It works good but when I try to validate either the File size or the File Type(again) and I return an Error 400 Bad Request response with some message I'm not able to catch it on the frontend. I tried to figure out where the xhr call will be fired from the mdb file input module but I was not able to find it. Can you please help me how to handle the callback errors, or where can I find the xhr call?

Thank you very much.

Arkadiusz Idzikowski staff answered 4 years ago

You can add something like this to the onUploadOutput method:

  } else if (output.type === 'done') {
    if (output.file.responseStatus === 400) {
      // do something

kepner priority commented 4 years ago

Thank you very much for the fast response! :)

Please insert min. 20 characters.


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



Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Angular
  • MDB Version: 8.4.0
  • Device: Desktop
  • Browser: Chrome 78.0.3904.70 64bit
  • OS: Windows10 Prof 64bit
  • Provided sample code: No
  • Provided link: No