jQuery MiniUI

 找回密码
 立即注册
查看: 3647|回复: 6
打印 上一主题 下一主题

关于上传的问题 [复制链接]

Rank: 2

跳转到指定楼层
楼主
发表于 2014-5-29 16:32:27 |只看该作者 |倒序浏览
使用fileupload上传,
后台部分代码用的是demo中,upload.JSP文件中的代码。
但是运行到下面这行代码的时候,会报错:,cos.JAR包也导入了,还缺什么东西吗?
public void addUpload(HttpServletRequest request, HttpServletResponse response,HttpSession session) throws Exception{
         ***
         MultipartRequest multi = new MultipartRequest(request,uploadPath,100 * 1024 * 1024, "utf-8");

         ***
}

java.io.IOException: Corrupt form data: premature ending
        at com.oreilly.servlet.multipart.MultipartParser.<init>(MultipartParser.java:207)
        at com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:223)
        at com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:174)
        at com.cn.controller.uploadController.addUpload(uploadController.java:38)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:619)

Rank: 8Rank: 8

沙发
发表于 2014-5-29 17:04:52 |只看该作者
你有测试过在你们环境下,我们的上传例子能否正常上传的?

Rank: 2

板凳
发表于 2014-5-29 17:08:44 |只看该作者
factory 发表于 2014-5-29 17:04
你有测试过在你们环境下,我们的上传例子能否正常上传的?

http://www.miniui.com/demo/#src=fileupload/fileupload.html
这个是可以上传的

Rank: 8Rank: 8

地板
发表于 2014-5-29 17:11:00 |只看该作者
ralf5753 发表于 2014-5-29 17:08
http://www.miniui.com/demo/#src=fileupload/fileupload.html
这个是可以上传的

试用包里的上传demo可以正常跑吗?

Rank: 2

5#
发表于 2014-5-29 17:14:47 |只看该作者
felt 发表于 2014-5-29 17:11
试用包里的上传demo可以正常跑吗?

试用包里上传的demo跑不了,点击浏览没反应

Rank: 8Rank: 8

6#
发表于 2014-5-29 17:21:26 |只看该作者
ralf5753 发表于 2014-5-29 17:14
试用包里上传的demo跑不了,点击浏览没反应

fileupload需要flash的,你更新下flash试试

Rank: 2

7#
发表于 2014-5-30 11:24:29 |只看该作者
本帖最后由 ralf5753 于 2014-5-30 11:36 编辑

找到原因了,项目配置文件中有上传文件的配置,冲突了

Archiver|普加软件

GMT+8, 2024-11-1 09:33 , Processed in 1.048767 second(s), 9 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部