I find it hard to check the size of the file on client side (browser) only with pure javascript.
Now, I have a question, is there any way on the server side to catch such an exception?
org.springframework.web.multipart.MaxUploadSizeExceededException: What is the maximum upload size bytes of 2000000 What happens is not reaching my @controller post method And it throws an exception which is my error. Being caught by Jsp.
What was I thinking that it is possible to do this Spring MVC annotated method?
@RequestMapping ("/ uploadFile.htm") Public string upload attachment (HttpServletRequest request, @RequestParam MultipartFile file, modelmap model) throws exceptions {if (check files (file)) / / Add error to / populate model // apiapable / start my problem is that it does not reach this point and just throws a bigger exception. Although Error.jsp was able to capture it, I feel that if it is user-friendly, I can warn the user that the file that is about to upload is more than the limit.
This is the way the Spring MVC 2.5 app is. Is this possible?
This exception is inserted in DispatcherServlet.doDispatch () , so you This is the handler extension resistor .
should be able to capture it.
Comments
Post a Comment