文件上传的时候报错,在本地测试都没问题,在服务器上面测试就出问题,只要上传文件超过140k就报错,报错信息是
com.jspsmart.upload.SmartUploadException: Unable to upload.
com.jspsmart.upload.SmartUpload.upload(SmartUpload.java:131)
com.ibm._jsp._zzfw_5F_save_5F_jxl._jspService(_zzfw_5F_save_5F_jxl.java:141)
com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:85)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:115)com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:168)
com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:92)
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:744)
com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1425)
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:92)
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:274)
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)
com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
com.ibm.io.async.ResultHandler.complete(ResultHandler.java:193)
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:725)
com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:847)
com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1498)
很急......求解.路径其他都没有问题,只要上传文件大于140k就上传不了了.
------解决方案--------------------
老大 这个绝对不可能啊 ,你看看 我以前写的代码:
- Java code
<%@page import="com.jspsmart.upload.SmartUpload" pageEncoding="UTF-8"%><%@page import="com.jspsmart.upload.File"%><%@page import="com.jspsmart.upload.Request"%><% //创建smartUpload对象 SmartUpload smartUpload = new SmartUpload(); smartUpload.initialize(pageContext); //初始化 smartUpload.setCharset("UTF-8"); try{ //定义文件允许上传类型 smartUpload.setAllowedFilesList("jpg,doc"); //定义文件不允许上传类型 smartUpload.setDeniedFilesList("txt"); smartUpload.setMaxFileSize(200000); //开始上传 smartUpload.upload(); //获取request对象 Request req = smartUpload.getRequest(); String name = req.getParameter("param"); out.print(name); //得到单个文件上传信息 File file = smartUpload.getFiles().getFile(0); if(!file.isMissing()){ //设置文件在服务器重保存的位置 String filePath = "/file/"; filePath += file.getFileName(); file.setCharset("UTF-8"); file.saveAs(filePath,SmartUpload.SAVE_VIRTUAL); //response.sendRedirect("index.jsp"); } }catch(Exception e){ e.printStackTrace(); } %>
------解决方案--------------------
不可能吧,况且上传的大小有个方法可以自己控制的。但是有一个上限,记不清是多少了。