struts1.2上传文件大小限制

在用struts1.2做文件上传时,大文件总是上传不了,但又找不到具体原因,其实是因为struts1.2配置文件文件了限制,<controller maxFileSize="2M" inputForward="true" /> ,就是这个限制现在了大小,可以根据实际情况修改
<?xml version="1.0" encoding="iso-8859-1"?> 
<!DOCTYPE struts-config PUBLIC 
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" 
"http://struts.apache.org/dtds/struts-config_1_2.dtd"> 
<struts-config> 
<form-beans> 
<form-bean name="uploadForm" type="org.apache.struts.webapp.upload.UpLoadForm" /> 
</form-beans> 
<action-mappings> 
<action path="/upload" forward="/selfile.jsp" /> 
<!-- Upload Action --> 
<action path="/uploadsAction" 
type="org.apache.struts.webapp.upload.UpLoadAction" 
name="uploadForm" scope="request" input="input"> 
<forward name="input" path="/selfile.jsp" /> 
<forward name="display" path="/display.jsp" /> 
</action> 
</action-mappings> 
<!-- 这里设置上传文件的最大值。 -1 不限制大小。缺省值:-1 --> 
<controller maxFileSize="2M" inputForward="true" /> 
<message-resources parameter="org.apache.struts.webapp.upload.UploadResources"/> 

</struts-config> 


资源文件:UploadResources_zh_CN.properties 
maxLengthExceeded=已经超过了上传文件所允许的最大值。 
maxLengthExplanation=注意:这个应用程序允许上传文件的最大值是2M。请看"/WEB-INF/upload/struts-config.xml" 文件更改这个值。 

版权声明:本文为博主原创文章,未经博主允许不得转载。

原文地址:https://www.cnblogs.com/shipeng22022/p/4614117.html