You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2023/03/02 06:44:26 UTC
[struts-site] 01/01: WW-5285 Documents struts.multipart.maxFiles option
This is an automated email from the ASF dual-hosted git repository.
lukaszlenart pushed a commit to branch WW-5285-max-files
in repository https://gitbox.apache.org/repos/asf/struts-site.git
commit 1a2aba89fb2b870fe2d0bc7864da152b16d5ce28
Author: Lukasz Lenart <lu...@apache.org>
AuthorDate: Thu Mar 2 07:44:16 2023 +0100
WW-5285 Documents struts.multipart.maxFiles option
---
source/core-developers/file-upload.md | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/source/core-developers/file-upload.md b/source/core-developers/file-upload.md
index 4e2884684..9a7ddd3cc 100644
--- a/source/core-developers/file-upload.md
+++ b/source/core-developers/file-upload.md
@@ -282,26 +282,23 @@ in necessary to change these values. The names and default values are:
struts.multipart.parser=jakarta
struts.multipart.saveDir=
struts.multipart.maxSize=2097152
+struts.multipart.maxFiles=256
```
-> Please remember that the `struts.multipart.maxSize` is the size limit of the whole request, which means when you uploading multiple files,
-> the sum of their size must be below the `struts.multipart.maxSize`!
+> Please remember that the `struts.multipart.maxSize` is the size limit of the whole request, which means when you're
+> uploading multiple files, the sum of their size must be below the `struts.multipart.maxSize`!
-In order to change theses settings you define a constant in your applications `struts.xml` file like so:
+In order to change these settings you define a constant in your applications `struts.xml` file like so:
```xml
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE struts PUBLIC
- "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
- "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.multipart.maxSize" value="1000000"/>
...
</struts>
```
-Additionally the `fileUpload` interceptor has settings that can be put in place for individual action mappings by
-customizing your interceptor stack.
+Additionally, the `fileUpload` interceptor has settings that can be put in place for individual action mappings
+by customizing your interceptor stack.
```xml
<action name="doUpload" class="com.example.UploadAction">
@@ -327,10 +324,6 @@ sizes. The other setting, `maximumSize`, is an interceptor setting that is used
receive a file that is too large. Notice the locations of both settings in the following example:
```xml
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE struts PUBLIC
- "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
- "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.multipart.maxSize" value="1000000"/>
@@ -345,7 +338,19 @@ receive a file that is too large. Notice the locations of both settings in the f
<result name="success">good_result.jsp</result>
</action>
</struts>
+```
+
+### Files Number Limit
+
+Since Struts 6.2.0 a new option was added, which uses Commons fileupload feature to limit how many files can be uploaded
+at once, in one request. This option requires to use Commons fileupload version 1.5 at least and by default is set to 256.
+To change this value define a constant in `struts.xml` as follows:
+```xml
+<struts>
+ <constant name="struts.multipart.maxFiles" value="500"/>
+
+</struts>
```
### File Types