日期:2014-05-17  浏览次数:20874 次

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试试
------解决方案--------------------
没学过才可以学 
都学过了 那还学什么?