"Matt" <jr********@hotmail.com> wrote in message
news:ba**************************@posting.google.c om...
<input type="file" size=50"> will produce the browse button
and browse text box.
The user can either select the file from browse button,
or enter a path in browse text box manually. My question is if
there are any client-side code to check if the path exists
in this case? My understanding is that no client-side
solution to this problem.
please advise. thanks!!
This does what (I think) you want but it issues a security warning.
<html>
<head>
<title>typefile.htm</title>
<script type="text/javascript">
function typefile() {
var form = document.forms[0];
var file = form.what.value;
var fold = file.substr(0,file.lastIndexOf("\\"));
window.status = file + " : " + fold;
var oFSO = new ActiveXObject("Scripting.FileSystemObject")
if (!oFSO.FolderExists(fold)) {
alert("Folder does not exist!");
} else if (!oFSO.FileExists(file)) {
alert("File does not exist!");
}
}
</script>
</head>
<body>
<form>
<input type="file" name="what" size=50" onchange="typefile()">
</form>
</body>
</html>