Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations danielledunham on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validating files on Local Drive

Status
Not open for further replies.
Jun 19, 2003
1
US
Does anyone know how to use jave script to validate if a file exists on a local hard drive? The Java script will be embedded in an ASP page. I am new to using Java Script so any help would be greatly appreciated. Thanks
 
You might be able do this if the file is an image by using something like:

<img src=&quot;&quot; width=1 height=1 name=&quot;checkImg&quot;>
<script>
checkImg.src=&quot;c:\test.gif&quot;
checkImgLoad(0);
function checkImgLoad(n){
if(n>50){alert('Image taking too long to load!')}
else if(checkImg.complete){alert('Image exists!')}
else{setTimeout('checkImgLoad('+(n++)+')',50)}
}
</script>

Highly doubtful if the file is not an image.

Adam
while(ignorance==true){perpetuate(violence,fear,hatred);life--};
 
I think the local drive is supposed to be off limits to the JavaScript sand box. I certainly don't want some stranger's script snooping around on MY hard drive!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top