当前位置: 技术问答>java相关
有关jspsmartupload的问题?大家看看这样的代码为什么出现这样的错误!
来源: 互联网 发布时间:2017-03-31
本文导语: 源代码: 错误如下: java.lang.IllegalArgumentException: Files' name is invalid or does not exist (1205). at com.jspsmart.upload.Files.getFile(Files.java:73) at jsp_servlet._jichu._microtissue.__addnewdone._jspService(__addnewdone.java:114) at weblogic.servle...
源代码:
错误如下:
java.lang.IllegalArgumentException: Files' name is invalid or does not exist (1205).
at com.jspsmart.upload.Files.getFile(Files.java:73)
at jsp_servlet._jichu._microtissue.__addnewdone._jspService(__addnewdone.java:114)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:945)/uploadsample/1040219305515
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:332)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5363)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:721)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3043)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2466)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
我在根目录下建了uploadsample目录,文件名想让它自动生产,且不重复.
错误如下:
java.lang.IllegalArgumentException: Files' name is invalid or does not exist (1205).
at com.jspsmart.upload.Files.getFile(Files.java:73)
at jsp_servlet._jichu._microtissue.__addnewdone._jspService(__addnewdone.java:114)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:945)/uploadsample/1040219305515
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:332)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5363)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:721)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3043)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2466)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
我在根目录下建了uploadsample目录,文件名想让它自动生产,且不重复.
|
注意 ENCTYPE="multipart/form-data">
|
String sample="/uploadsample/"+new Long(System.currentTimeMillis()).toString();
这句话不对,用绝对路径
String sample="C:\" + new Long(System.currentTimeMillis()).toString();
试试
这句话不对,用绝对路径
String sample="C:\" + new Long(System.currentTimeMillis()).toString();
试试
|
你就用日期做为文件夹名 建个文件夹 然后把文件传到相应的文件夹就行了
新建文件夹
java.io.File fileNew=new java.io.File(路径和文件夹名);
fileNew.mkdirs();
然后用jspsmartupload中的saveAs()方法就可以了
新建文件夹
java.io.File fileNew=new java.io.File(路径和文件夹名);
fileNew.mkdirs();
然后用jspsmartupload中的saveAs()方法就可以了
|
String path = request.getRealPath("\upload\");
String smeltway=new String(srequest.getParameter("smeltway").getBytes("ISO8859-1"),"GBK");
String smeltway=new String(srequest.getParameter("smeltway").getBytes("ISO8859-1"),"GBK");