When judging the client file, you can use
Copy code code as follows:
var fso, s = filespec; // filespec = "c: /path/myfile.txt"
fSO = New Activexobject ("Scripting.fileSystemObject");
if.fileexists (Filespec))
s+= "exists.";
else
s+= "DOESN'T Exist.";;
alert (s);
When judging the server side (network file), you can use
Copy code code as follows:
var xmlhttp = New ActivexObject ("Microsoft.xmlhttp");
xmlhttp.open ("get", your, false);
xmlhttp.send ();
if (xmlhttp.readyState == 4) {{
if (xmlhttp.status == 200) s+= "exists."; // URL exists
else if (xmlhttp.status == 404) s+= "doesn't exist."; // URL does not exist
else s+= ""; // Other states
}
alert (s);
You can <input type = "file" name = "ID =" "ContentEditable =" FALSE "> Set ContentEditable to False to limit users to only choose files, not input.