http://expert.csdn.net/Expert/TopicView1.asp?id=2820795

解决方案 »

  1.   

    有安全提示..<script>  
    function checkExist(file) {
    var fso=new ActiveXObject("Scripting.FileSystemObject");
    if(fso.fileexists(file))alert("存在") 
    else alert("不存在");
    delete fso;
    }
    </script> 
    <input type=file name=myfile>
    <input type=button onclick="checkExist(document.all.myfile.value)" value="Check">
      

  2.   

    FileExists 方法   描述
    如果指定文件存在返回 True ;否则返回 False 。
    语法
    object.FileExists(filespec) 
    FileExists 方法的语法包括了以下部分: 部分 描述 
    object 必选项。 应为 FileSystemObject 的名称。 
    filespec 必选项。 需要判定是否存在的文件的名称. 如果文件可能不在当前文件夹中,那么必须提供完整的路径说明(可以是绝对的或相对的)。 
    下面的例子说明了 FileExists 方法的用法: function ReportFileStatus(filespec)
    {
      var fso, s = filespec;
      fso = new ActiveXObject("Scripting.FileSystemObject");
      if (fso.FileExists(filespec))
        s += " exists.";
      else 
        s += " doesn't exist.";
      return(s);
    }