Posted content type isn't multipart/form-data

页面html:

    <form class="form-horizontal" id="form1" action="${cxt!}/ws/api/iotbusi/uploadfile2" enctype="multipart/form-data" method="POST">

 

报的错 :

java.lang.RuntimeException: java.io.IOException: Posted content type isn't multipart/form-data

at com.jfinal.upload.MultipartRequest.wrapMultipartRequest(MultipartRequest.java:123)

at com.jfinal.upload.MultipartRequest.<init>(MultipartRequest.java:68)

at com.jfinal.core.Controller.getFiles(Controller.java:767)

at com.jfinal.core.Controller.getFile(Controller.java:777)

at ws.iot.api.BusiController.uploadfile2(BusiController.java:255)

at sun.reflect.GeneratedMethodAccessor96.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.jfinal.aop.Invocation.invoke(Invocation.java:73)

at com.jfinal.i18n.I18nInterceptor.intercept(I18nInterceptor.java:106)

at com.jfinal.aop.Invocation.invoke(Invocation.java:67)

at com.jfinal.plugin.activerecord.tx.TxByActionKeyRegex.intercept(TxByActionKeyRegex.java:61)

at com.jfinal.aop.Invocation.invoke(Invocation.java:67)

at com.jfinal.plugin.activerecord.tx.TxByActionKeys.intercept(TxByActionKeys.java:57)

at com.jfinal.aop.Invocation.invoke(Invocation.java:67)

at com.jfinal.plugin.activerecord.tx.TxByMethodRegex.intercept(TxByMethodRegex.java:61)

at com.jfinal.aop.Invocation.invoke(Invocation.java:67)

at com.jfinal.plugin.activerecord.tx.TxByMethods.intercept(TxByMethods.java:57)

at com.jfinal.aop.Invocation.invoke(Invocation.java:67)

at ws.platform.interceptor.ParamPkgInterceptor.intercept(ParamPkgInterceptor.java:92)

at com.jfinal.aop.Invocation.invoke(Invocation.java:67)

at ws.platform.interceptor.AuthInterceptor.intercept(AuthInterceptor.java:73)

at com.jfinal.aop.Invocation.invoke(Invocation.java:67)

at com.jfinal.core.ActionHandler.handle(ActionHandler.java:82)

at ws.platform.handler.GlobalHandler.handle(GlobalHandler.java:84)

at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:77)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)

at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)

at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)

at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)

at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)

at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)

at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)

at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)

at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)

at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)

at org.eclipse.jetty.server.Server.handle(Server.java:497)

at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)

at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)

at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)

at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)

at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)

at java.lang.Thread.run(Unknown Source)

Caused by: java.io.IOException: Posted content type isn't multipart/form-data

at com.oreilly.servlet.multipart.MultipartParser.<init>(MultipartParser.java:168)

at com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:223)

at com.jfinal.upload.MultipartRequest.wrapMultipartRequest(MultipartRequest.java:107)


评论区

小风

2017-08-29 15:37

正常都是第一张图片可以第二张不行。是在微信公众号里的图片,useragent是微信内部浏览器

JFinal

2017-08-29 19:48

很可能是客户端没按 http 标准上传文件,异常是: Posted content type isn't multipart/form-data

证明文件格式不对

小风

2017-08-30 06:49

@JFinal 第一张图片是可以的。看过你之前的回复,可能是因为tomcat跳转的问题。我这边用的jetty 也会是这个原因 吗

JFinal

2017-08-30 11:38

@小风 重定向的问题只有 tomcat 会有,jetty 不可能有,看这篇问答:
http://www.oschina.net/question/941098_93842

热门反馈

扫码入社