`
Suzh.Q
  • 浏览: 18899 次
  • 性别: Icon_minigender_1
  • 来自: 大连
社区版块
存档分类
最新评论

Struts2 上传文件报错:Request exceeded size limit!

阅读更多

警告: Request exceeded size limit!

org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (21112668) exceeds the configured maximum (2097152)

 

struts2中文件上传拦截,首先通过struts2 的核心包下的default.properties文件里有默认的大小为struts.multipart.maxSize=2097152,也就是2M. 这是struts2默认拦截,也可以定义自己的拦截器在进行拦截。可根据自己的某个模块业务自行进行二次拦截。

 

解决方法:

在struts.xml配置文件中,添加<constant name="struts.multipart.maxSize" value="10485760"/> 这里的value单位为B,即10485760B = 10MB。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics