Is MaxUploadSizeExceededException handled, but is the STILL file uploaded?

Therefore, I use Spring Webflow to upload the file and CommonsMultipartResolver with the maximum file size setting.

When the maximum file size exceeds the value of CommonsMultipartResolver , it throws a MaxUploadSizeExceededException , which I will catch and handle just fine, returning to the original view using the new ModelAndView with an error message added to the model.

Is the problem that the STILL browser goes through the file upload process anyway? Is there any way to stop this? I don’t want my users to spend their time downloading 10 or 20 megabytes of files to report that the maximum limit is 5 megabytes (or some similar example) ...

+4
source share
2 answers

you need to close the incoming stream of the incoming request.

0
source

Can you check request.getContentLength() or request.getHeaders("Content-Length") ? Like, for example, in a filter or interceptor.

( How do I know the file size when downloading via multipart form-data? )

0
source

Source: https://habr.com/ru/post/1382280/


All Articles