微信小程序上传图片报错

报错
org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is java.io.IOException: org.apache.tomcat.util.http.fileupload.FileUploadException: the request was rejected because no multipart boundary was found↵org.springframework.web.multipart.support.StandardMultipartHttpServletRequest.handleParseFailure(StandardMultipartHttpServletRequest.java:124)↵org.springframework.web.multipart.support.StandardMultipartHttpServletRequest.parseRequest(StandardMultipartHttpServletRequest.java:115)↵org.springframework.web.multipart.support.StandardMultipartHttpServletRequest.<init>(StandardMultipartHttpServletRequest.java:88)↵org.springframework.web.multipart.support.StandardServletMultipartResolver.resolveMultipart(StandardServletMultipartResolver.java:87)↵org.springframework.web.servlet.DispatcherServlet.checkMultipart(DispatcherServlet.java:1178)↵org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1012)↵org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)↵org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)↵org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)↵javax.servlet.http.HttpServlet.service(HttpServlet.java:660)↵org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)↵javax.servlet.http.HttpServlet.service(HttpServlet.java:741)↵org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)↵org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)↵org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)↵org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)↵org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)↵org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113)↵org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)↵org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)↵com.definesys.mpaas.query.filter.MpaasFilter.doFilter(MpaasFilter.java:62)↵org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)↵org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)↵com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)↵org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)↵org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)↵org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)↵org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)↵org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)↵org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)↵org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:118)↵org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)↵org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)↵org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)↵org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)↵org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)↵org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:158)↵org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)↵org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)↵org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)↵com.hq.book_design_service.config.filter.JwtAuthenticationTokenFilter.doFilterInternal(JwtAuthenticationTokenFilter.java:76)↵org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)↵org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)↵org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)↵org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)↵org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:92)↵org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:77)↵org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)↵org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)↵org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)↵org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)↵org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)↵org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)↵org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)↵org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)↵org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)↵org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)↵org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)↵org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)↵org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)↵org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)↵org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)↵org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)↵org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)↵org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)↵org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)↵org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)↵org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)↵org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)↵org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)↵org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)↵org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)↵org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)↵org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)↵org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)↵org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)↵org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)↵org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)↵org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)↵org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)↵org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)↵org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860)↵org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1598)↵org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)↵java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)↵java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)↵org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)↵java.lang.Thread.run(Thread.java:748)↵Caused by:↵java.io.IOException: org.apache.tomcat.util.http.fileupload.FileUploadException: the request was rejected because no multipart boundary was found"

已经参考过网上给出的解决办法
1.重启你的项目就可以了(我采用的这种)
2.在application.yml文件中设置multipart location ,并重启项目
但是还是没有解决问题
请问各位大神有什么方法吗

阅读 3.1k
1 个回答

the request was rejected because no multipart boundary was found。这个提示应该比较明显了。多试试前端上传的contentType类型

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