我试图从JSP文件上传文件,我在catalina.out中收到以下错误.正如许多博客中所指出的,我在webapps/manager/WEB-INF/web.xml下增加了max-file-size,但我仍然遇到同样的问题......我应该在哪里增加它来解决这个错误?
<multipart-config>
<!-- 50MB max -->
<max-file-size>5242880000000</max-file-size>
<max-request-size>5242880000000</max-request-size>
<file-size-threshold>0</file-size-threshold>
</multipart-config>
org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (341297) exceeds the configured maximum (51200)
Run Code Online (Sandbox Code Playgroud)
小智 18
我有同样的问题.我通过maxPostSize
在http服务器tomcat连接器中设置参数来解决它,<tomcat-root-folder>/conf/server.xml
如下所示:
<Connector connectionTimeout="20000"
port="8080"
protocol="HTTP/1.1"
redirectPort="8443"
maxPostSize="52428800" />
Run Code Online (Sandbox Code Playgroud)
设置maxPostSize
为52428800
将上传文件大小增加到50 MB
.默认情况下,它设置为2 MB
.
有关更多说明,请阅读:https://tomcat.apache.org/tomcat-7.0-doc/config/http.html
这里有一个配置它的例子.
http://svn.apache.org/repos/asf/tomcat/tc7.0.x/trunk/webapps/manager/WEB-INF/web.xml
管理器应用程序使用Servlet 3.0 API.如果您直接使用commons文件上传,则由您决定,您需要手动配置.
https://maxrohde.com/2011/04/27/large-war-file-cannot-be-deployed-in-tomcat-7/
转到管理器应用程序的web.xml(例如,它可能位于/tomcat7/webapps/manager/WEB-INF/web.xml下。增大max-file-size和max-request-size:
<multipart-config>
<!– 50MB max –>
<max-file-size>52428800</max-file-size>
<max-request-size>52428800</max-request-size>
<file-size-threshold>0</file-size-threshold>
</multipart-config>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
36778 次 |
最近记录: |