限制struts2上传类型和大小

    <action name="upload"  class="UploadAction">
	    <interceptor-ref name="defaultStack">
			<!-- 配置允许上传的文件类型,多个用","分隔-->
			<param name="fileUpload.allowedTypes">
				application/msword,application/pdf,application/zip
			</param> 
			<!-- 配置允许上传的文件大小,单位字节 -->
			<param name="fileUpload.maximumSize">10485760</param>
		</interceptor-ref>
		<result name="input">error.jsp</result>
    	<result name="success">index.jsp</result>
    </action>

你可能感兴趣的:(限制struts2上传类型和大小)