struts配置文件
<action name="upload" class="strutsFileUpload"> <result name="input" type="redirect">/admin/ChangePhoto.jsp</result> <result name="adminSuccess" type="redirect">/admin/index2.jsp</result> <result name="userSuccess" type="redirect">/admin/index.jsp</result> <interceptor-ref name="defaultStack"> <param name="fileUpload.maximumSize">1000000000</param> <param name="fileUpload.allowedTypesSet">image/jpg,image/png,image/jpeg</param> </interceptor-ref> </action>
在最上面加一句
<constant name="struts.multipart.maxSize" value="9000000"/>就可以5M 其他的类推
<struts> <constant name="struts.i18n.encoding" value="GBK"></constant> <constant name="struts.multipart.maxSize" value="9000000"/> <package name="fileUpload" namespace="/" extends="struts-default"> <action name="showUpload"> <result>/admin/ChangePhoto.jsp</result> </action> <action name="upload" class="strutsFileUpload"> <result name="input" type="redirect">/admin/ChangePhoto.jsp</result> <result name="adminSuccess" type="redirect">/admin/index2.jsp</result> <result name="userSuccess" type="redirect">/admin/index.jsp</result> <interceptor-ref name="defaultStack"> <param name="fileUpload.maximumSize">1000000000</param> <param name="fileUpload.allowedTypesSet">image/jpg,image/png,image/jpeg</param> </interceptor-ref> </action> ...
版权声明:本文为博主原创文章,未经博主允许不得转载。