当前位置: 代码迷 >> Java Web开发 >> Files' name is invalid or does not exist (1205).这是关于什么的异常
  详细解决方案

Files' name is invalid or does not exist (1205).这是关于什么的异常

热度:9789   发布时间:2013-02-25 21:16:29
Files' name is invalid or does not exist (1205).这是关于什么的错误
每次上传文件都报这个错误。。(我的是信息上传数据库并把选中文件上传到项目指叮文件夹中)
java.lang.IllegalArgumentException: Files' name is invalid or does not exist (1205).
com.jspsmart.upload.Files.getFile(Files.java:73)
org.apache.jsp.zhuceadmin_jsp._jspService(zhuceadmin_jsp.java:58)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

下面是文件(上传部分)
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%@ page import="huayu.com.*"%>
<jsp:directive.page import="com.jspsmart.upload.*"/>
<jsp:directive.page import="java.io.FileOutputStream"/>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
SmartUpload su=new SmartUpload();
su.initialize(pageContext);
su.upload();
File fe=su.getFiles().getFile(0); 
File f=su.getFiles().getFile(1);
DengLuBean dlb=new DengLuBean();
dlb.setName(su.getRequest().getParameter("name"));
dlb.setPwd(su.getRequest().getParameter("pwd"));
dlb.setEmail(su.getRequest().getParameter("email"));
byte[] b=new byte[f.getSize()];
for(int i=0;i<f.getSize();i++)
{
b[i]=f.getBinaryData(i);
}
dlb.setPhoto(b);
String p=application.getRealPath("/");
fe.saveAs(p+"tmp/"+fe.getFileName(),fe.SAVEAS_PHYSICAL);
boolean ok=DengLuDBC.add(dlb);

------解决方案--------------------------------------------------------
一定是上传了两个文件么?
File fe=su.getFiles().getFile(0); 
File f=su.getFiles().getFile(1);

改用commons fileupload试试
------解决方案--------------------------------------------------------
没学过才可以学 
都学过了 那还学什么?
  相关解决方案
本站暂不开放注册!
内测阶段只得通过邀请码进行注册!