bootstrap-fileinput traps some errors and successfully shows up validation in red within the control area very nicely.
In my handler I trigger an exception on purpose because I want to handle an exception and do so in my web page.
However, I do not seem to be able to get my own expection to trigger the red validation response from fileinput.
I have linked into all events and none seem to give me what I want which is an error message backup from fileinput send by my ajax method.
and currently I don’t even seem to be able to get data back from fileinput.
If I populate uploadExtraData then all I seem to be able to do is get the same data back in my web service.
For my deliberate exception, I get a full page ASP error for every file I am trying to upload which is messy.
yes I can redirect to a bespoke error page but I want to be able to handle the exception all on the one page as I can do with usual web methods.
does anyone know what I could be doing wrong?
A follow up to this.
If I do not send a properly crafted json response of some kind, I get a red error line
mg_20160606_132613.jpg: SyntaxError: Unexpected end of JSON input.
which is exactly what I want from any errors that I get in the uploadhandler.
I believe the problem may be in the content of the json I send back.
Is there a specific structure that fileinput will understand as being a successful upload and one that indicates an error, do I have to pass specific key names back in json?
I can’t use Event Manipulation as this is client side and the responses I get back from all error events do not give me anything that I am able to amend to indicate an error condition has occurred in my handler on the server side so the only recourse is to allow an exception server side which can be messy when cotrol is passed back to the client.