I have an application that allows people to submit multiple files via the web. I'm using a jQuery multiple file upload
plugin on the front-end and I'm using Apache's FileUpload on the backend in my
servlet.
I'm running into a problem where if the user tries to upload a file that exceeds the maximum size, I get an exception
and I can't seem to trap it. That means I can't display a meaningful error back to the user.
I've done some Google searches and found some code that looks like it may work, but it's way too complex for me
to even begin understanding and most of it seems to involve either
Struts, myFaces or Spring, none of which I'm
currently using.
Any ideas on how I can gracefully notify the user that the file is too large to upload?
This is (part of) the stack trace I get:
The error occurs when I try to do this:
I try to catch it as follows
but it isn't caught.
Here's more complete code: