france

https://github.com/francecil

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理



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>
...



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

posted on 2014-10-18 16:22  france  阅读(186)  评论(0编辑  收藏  举报