4

So I'm using Spring Webflow to upload a file and the CommonsMultipartResolver with a max file size param.

When the max file size is exceed the CommonsMultipartResolver throws a MaxUploadSizeExceededException which I'm catching and handling just fine by returning to my original view with a new ModelAndView with an error message added to the model.

Problem is, the browser STILL goes through the process of uploading the file anyway?? Is there any way to stop this? I don't really want my users to spend their time uploading 10 or 20 meg files only to be told the max limit is 5 meg (or some similar example)...

dbreaux
  • 4,982
  • 1
  • 25
  • 64
Nick Foote
  • 2,425
  • 9
  • 36
  • 47
  • Looks like https://issues.apache.org/jira/browse/FILEUPLOAD-145 Though updating to commons-fileupload-1.3 did not solve the issue for me! – oae Oct 15 '13 at 22:40
  • 1
    I am facing the same issue! Any thing work for you? – abhig Jun 03 '15 at 17:10

2 Answers2

0

you have to close the incoming request input stream.

Roman K
  • 3,309
  • 1
  • 33
  • 49
0

Can you first check the request.getContentLength() or request.getHeaders("Content-Length")? Like in a Filter or Interceptor if necessary.

( How to know the file size when uploading via multipart form-data? )

Community
  • 1
  • 1
dbreaux
  • 4,982
  • 1
  • 25
  • 64