Struts2上传文件的默认大小为2MB,是因为在Struts2的默认配置文件“default.properties”中定义了:struts.multipart.maxSize=2097152(1024*1024*2)单位是b。
要修改默认大小的话,有两种方法:①:找到“default.properties”,修改默认值。
路径见图:
②:利用struts.xml中的<constant>节点
<constant name="struts.multipart.maxSize" value="20971520"></constant> //20971520=20*1024*1024,就是20MB