SpringBoot 框架下如何实现文件的分片上传
问题描述,一个20KB的文件,在文件上传时,如何实现分片上传,每片3KB。有没有这方面的文章什么的。谢谢各位大大。因为一次性上传20KB,有问题,一直报错:
ERROR [qtp2142023789-181] o.s.boot.web.support.ErrorPageFilter:176- Forwarding to error page from request [/file/uploads] due to exception [Could not parse multipart servlet request; nested exception is java.io.IOException: Incomplete parts]
org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is java.io.IOException: Incomplete parts
at org.springframework.web.multipart.support.StandardMultipartHttpServletRequest.parseRequest(StandardMultipartHttpServletRequest.java:111)
at org.springframework.web.multipart.support.StandardMultipartHttpServletRequest.<init>(StandardMultipartHttpServletRequest.java:85)
at org.springframework.web.multipart.support.StandardServletMultipartResolver.resolveMultipart(StandardServletMultipartResolver.java:79)
at org.springframework.web.servlet.DispatcherServlet.checkMultipart(DispatcherServlet.java:1099)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:932)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)
.....
Caused by: java.io.IOException: Incomplete parts
at org.eclipse.jetty.util.MultiPartInputStream.parse(MultiPartInputStream.java:739)
at org.eclipse.jetty.util.MultiPartInputStream.getParts(MultiPartInputStream.java:409)
at org.eclipse.jetty.server.Request.getParts(Request.java:2069)
at javax.servlet.http.HttpServletRequestWrapper.getParts(HttpServletRequestWrapper.java:351)
at org.springframework.web.multipart.support.StandardMultipartHttpServletRequest.parseRequest(StandardMultipartHttpServletRequest.java:92)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
spring boot multipart文件上传和springMVC 基本上一样,可能是你的代码有其他问题,我这有个demo你可以参考一下:https://git.oschina.net/74701...