復制代碼 代碼如下:
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);
}
采用客戶端的 FileSystemObject 對象
例:
復制代碼 代碼如下:
function check()
{
var fso;
fso = new ActiveXObject("Scripting.FileSystemObject");
if( fso.FileExists("c:\\testfile.txt"))
{
alert("Exists!");
}
else
{
alert("not Exists!");
}
}