用的jspsmartupload,提示文件名不能被保存
代码如下
<%@ page contentType="text/html;charset=GB2312"
    import="com.jspsmart.upload.*,
        java.util.*,
java.lang.*"
%><jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" /><HTML>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<BODY>
<%
// 初始化
final String UpFileType="zip|rar|doc";        //上传文件类型
final int MaxFileSize=1024000;        //上传文件大小限制
String ErrMsg=null;    //错误信息
boolean ERR=false;     //错误标志
mySmartUpload.initialize(pageContext);// 上传文件
mySmartUpload.upload();// 取当前文件
com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(0);
System.out.println(myFile);
// 取得文件并保存
if (!myFile.isMissing()) {
//得到文件扩展名
String FileType=myFile.getFileExt();
FileType=FileType.toLowerCase();   //将扩展名转换成小写
if (UpFileType.indexOf(FileType)==-1){
   ERR=true;
   ErrMsg="上传文件失败!目前只允许上传以下格式的文件:"+UpFileType;
}   
//得到文件大小
int FileSize=myFile.getSize();
if (ERR==false&&FileSize>MaxFileSize){
   ERR=true;
   ErrMsg="上传文件失败!文件大小超出了限定的范围(最大"+MaxFileSize/1024+"K)";
}   
if(ERR==false){
       //保存文件
       String newFileName="001."+FileType;   //可自动生成文件名以防止同名覆盖
   myFile.saveAs(newFileName);
}else{
   out.print ("<script>alert('"+ErrMsg+"');</script>");
}
}
%>
</BODY>
</HTML>