- 时间:2022-03-10 16:07 编辑: 来源: 阅读:
- 扫一扫,手机访问
摘要:JavaScript下利用fso判断文件是否存在的代码
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!");
}
}