• struts2文件上传突破2M限制




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



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

    today lazy . tomorrow die .
  • 相关阅读:
    Ubuntu上安装RabbitMQ
    解决tfs工作区绑定问题
    ubuntu装个nginx
    supervisor执行dotnet
    Validate + Boostrap tooltip 表单验证示例
    ASP.NET下跨应用共享Session和使用Redis进行Session托管
    IE下将网页拷贝到剪贴板
    js格式化json格式的日期
    js 时间戳转换
    Windows服务简单使用
  • 原文地址:https://www.cnblogs.com/france/p/4808622.html
Copyright © 2020-2023  润新知