org.apache.commons.fileupload.FileUploadBase 和 SizeLimitExceededException
org.apache.commons.fileupload.FileUploadBase and SizeLimitExceededException
我正在尝试在我的应用程序中上传文件。文件大小为 2055 kb。上传文件后。它抛出的异常是:
04-Feb-2016 15:42:41.141 INFO [http-nio-8084-exec-78] com.opensymphony.xwork2.util.logging.commons.CommonsLogger.info Unable to find 'struts.multipart.saveDir' property setting. Defaulting to javax.servlet.context.tempdir
04-Feb-2016 15:42:41.203 WARNING [http-nio-8084-exec-78] com.opensymphony.xwork2.util.logging.commons.CommonsLogger.warn Request exceeded size limit!"
org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (2104281) exceeds the configured maximum (2097152)
我正在使用 Struts 框架。
Struts2 允许配置上传文件的限制。
The Struts 2 default.properties
file defines several settings that affect the behavior of file uploading. You may find in necessary to change these values. The names and default values are:
struts.multipart.parser=jakarta
struts.multipart.saveDir=
struts.multipart.maxSize=2097152
注意,末尾没有 0
。
您可以通过设置常量来增加请求限制来更改此设置
<constant name="struts.multipart.maxSize" value="20971520" />
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
!
单个文件也有限制,您可以通过覆盖操作配置来更改该限制
<interceptor-ref name="fileUpload">
<param name="maximumSize">20971520</param>
</interceptor-ref>
有关 File Upload 的更多信息,您可以在文档页面上找到。
我正在尝试在我的应用程序中上传文件。文件大小为 2055 kb。上传文件后。它抛出的异常是:
04-Feb-2016 15:42:41.141 INFO [http-nio-8084-exec-78] com.opensymphony.xwork2.util.logging.commons.CommonsLogger.info Unable to find 'struts.multipart.saveDir' property setting. Defaulting to javax.servlet.context.tempdir
04-Feb-2016 15:42:41.203 WARNING [http-nio-8084-exec-78] com.opensymphony.xwork2.util.logging.commons.CommonsLogger.warn Request exceeded size limit!"
org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (2104281) exceeds the configured maximum (2097152)
我正在使用 Struts 框架。
Struts2 允许配置上传文件的限制。
The Struts 2
default.properties
file defines several settings that affect the behavior of file uploading. You may find in necessary to change these values. The names and default values are:struts.multipart.parser=jakarta struts.multipart.saveDir= struts.multipart.maxSize=2097152
注意,末尾没有 0
。
您可以通过设置常量来增加请求限制来更改此设置
<constant name="struts.multipart.maxSize" value="20971520" />
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 thestruts.multipart.maxSize
!
单个文件也有限制,您可以通过覆盖操作配置来更改该限制
<interceptor-ref name="fileUpload">
<param name="maximumSize">20971520</param>
</interceptor-ref>
有关 File Upload 的更多信息,您可以在文档页面上找到。