tomcat上传多个文件报错

1,公司项目需要通过web端需要让用户上传文件。上传单个文件没有问题,但是用户如果在上传文件的地方放多个图片就会无法上传。查看日志

2017-09-20 18:21:44.272 ERROR 9915 --- [io-8080-exec-12] o.s.boot.web.support.ErrorPageFilter     : Forwarding to error page from request [/information/edit] due to exception [Could not parse multipart ***servlet request; nested exception is java.lang.IllegalStateException: The m*ulti-part request contained parameter data (excluding uploaded files) that exceeded the limit for maxPostSize set on the associated connector]****

org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is java.lang.IllegalStateException: The multi-part request contained parameter data (excluding uploaded files) that exceeded the limit for maxPostSize set on the associated connector
    at org.springframework.web.multipart.support.StandardMultipartHttpServletRequest.parseRequest(StandardMultipartHttpServletRequest.java:111) ~[spring-web-4.3.5.RELEASE.jar:4.3.5.RELEASE]
    at org.springframework.web.multipart.support.StandardMultipartHttpServletRequest.<init>(StandardMultipartHttpServletRequest.java:85) ~[spring-web-4.3.5.RELEASE.jar:4.3.5.RELEASE]
    at org.springframework.web.multipart.support.StandardServletMultipartResolver.resolveMultipart(StandardServletMultipartResolver.java:76) ~[spring-web-4.3.5.RELEASE.jar:4.3.5.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.checkMultipart(DispatcherServlet.java:1099) ~[spring-webmvc-4.3.5.RELEASE.jar:4.3.5.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:932) ~[spring-webmvc-4.3.5.RELEASE.jar:4.3.5.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) ~[spring-webmvc-4.3.5.RELEASE.jar:4.3.5.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ~[spring-webmvc-4.3.5.RELEASE.jar:4.3.5.RELEASE]

2,解决方法,看到提示maxpostsize,故去修改server.xml中的maxpostsize改为0了,还是不行。换句话说并不是这个问题。

3,环境说明:直接裸奔tomcat 前端没有Nginx和apache,第2个就是项目用的框架spring boot

4,请问各位有什么好的讲义方法,谢谢。

阅读 4.9k
1 个回答

maxpostsize改为-1试下,不限制大小tomcat7开始就不能用等于0了,只能小于0
tomcat7.0.63(包含)之后:
maxPostSize The maximum size in bytes of the POST which will be handled by the container FORM URL parameter parsing. The limit can be disabled by setting this attribute to a value less than zero. If not specified, this attribute is set to 2097152 (2 megabytes).

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题