在接受的Servlet里判断:
String path = request.getParameter("FilePath");
File f = new File(path);
if(!f.exists()){
System.out.println("文件不存在。");
resp.sendredirect(ErrorUrl); //重定向到出错页
}else{//继续处理......
}
String path = request.getParameter("FilePath");
File f = new File(path);
if(!f.exists()){
System.out.println("文件不存在。");
resp.sendredirect(ErrorUrl); //重定向到出错页
}else{//继续处理......
}
可以在服务器端判断文件的大小,如果为0,并且文件路径存在,那么就说明在客户端---这个文件是不存在的。也可以在客户端用FSO检测文件是否存在,但是这样会弹出安全性对话框。
http://blog.csdn.net/jyy7751/archive/2005/06/17/396471.aspx