Re: Error Struts 7
Lukasz Lenart <[email protected]> Sun, 5 Oct 2025 19:45:17 +0200
| Newsgroups | gmane.comp.jakarta.struts.user |
|---|---|
| Message-ID | <CAMopvkOmj4sE0a_Fk6+_HHC5LhFuNFmQZRxDkQHJ=+3=v3JHQg@mail.gmail.com> |
Btw. this is already reported https://issues.apache.org/jira/browse/WW-5474 https://issues.apache.org/jira/browse/FILEUPLOAD-351 niedz., 5 pa=C5=BA 2025 o 19:42 Lukasz Lenart <[email protected]> nap= isa=C5=82(a): > > wt., 30 wrz 2025 o 21:21 Ute Kaiser <[email protected]> napisa=C5=82(a= ): > > I want to add some comments here about the somehow misleading documenta= tion on this. > > >> > > Files Number Limit > > > > Since Struts 6.1.2 a new option was added, which uses Commons FileUploa= d feature to limit how many files can be uploaded at once, in one request. = This option requires to use Commons FileUpload ver. 1.5 at least and by def= ault is set to 256. Please always set this to a finite value to prevent DoS= attacks. > > To change this value define a constant in struts.xml as follows: > > <struts> > > <constant name=3D"struts.multipart.maxFiles" value=3D"500"/> > > </struts> > > << > > > > Today, I used > > <constant name=3D"struts.multipart.maxFiles" value=3D"3"/> > > because I have 3 file upload tags on my mask. > > But the application crashed, even with only one file upload, till I fo= und a debug message in wildfly server.log > > >> > > 2025-09-30 15:14:22,443 DEBUG [org.apache.struts2.dispatcher.multipart.= AbstractMultiPartRequest] (default task-2) Applies max size: xxx to file up= load request > > 2025-09-30 15:14:22,443 DEBUG [org.apache.struts2.dispatcher.multipart.= AbstractMultiPartRequest] (default task-2) Applies max files number: 3 to f= ile upload request > > 2025-09-30 15:14:22,443 DEBUG [org.apache.struts2.dispatcher.multipart.= AbstractMultiPartRequest] (default task-2) Applies max size of single file:= xxx to file upload request > > 2025-09-30 15:14:22,483 DEBUG [org.apache.struts2.dispatcher.multipart.= AbstractMultiPartRequest] (default task-2) Error parsing the multi-part req= uest!: org.apache.commons.fileupload2.core.FileUploadFileCountLimitExceptio= n: attachment > > at deployment.resy.ear//org.apache.commons.fileupload2.core.Abstrac= tFileUpload.lambda$parseRequest$1(AbstractFileUpload.java:465) > > at deployment.resy.ear//org.apache.commons.io.function.IOIterator.f= orEachRemaining(IOIterator.java:77) > > at deployment.resy.ear//org.apache.commons.fileupload2.core.Abstrac= tFileUpload.parseRequest(AbstractFileUpload.java:462) > > at deployment.resy.ear//org.apache.commons.fileupload2.jakarta.serv= let6.JakartaServletFileUpload.parseRequest(JakartaServletFileUpload.java:11= 7) > > at deployment.resy.ear//org.apache.struts2.dispatcher.multipart.Jak= artaMultiPartRequest.processUpload(JakartaMultiPartRequest.java:51) > > << > > Debugging org.apache.commons told me that all my parameters counted, no= t only the fileupload parameter. > > Thanks for pointing this out, I can update the docs only as we base on > what Commons Fileupload provides > https://commons.apache.org/proper/commons-fileupload/commons-fileupload2-= core/apidocs/org/apache/commons/fileupload2/core/AbstractFileUpload.html#se= tFileCountMax(long) > > > Cheers > =C5=81ukasz