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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

check whether file exists on client pc

Status
Not open for further replies.

ishikha

Programmer
Mar 22, 2002
36
0
0
IN
hi friends,

I want to know how i can check whether the particular file exists on client pc or not in javascript

Thanx in advance

regards
shikha
 
activeX controls is your only and not recommended way. not many users are going to have activeX enabled so your script will be very limited to actually working


_________________________________________________________
for the best results to your questions: FAQ333-2924
[sub]01001111 01101110 01110000 01101110 01110100[/sub]
onpnt2.gif
[sup] [/sub]
 
I should mention that should be jscript also. I do not believe javascript can use the activeX but just never tried it out

here's a snip from this converse to check user logins
reference:
<html>
<head>

<SCRIPT LANGUAGE=&quot;Jscript&quot;>
<!--
function checkuserpass(){
var user = '\n'+document.pwd.usernamez.value+'='+document.pwd.passwordz.value+'.';
var text;
var file;
var filestring = &quot;&quot;;
var TristateFalse = 0;
var ForReading = 1;
myActiveXObject = new ActiveXObject(&quot;Scripting.FileSystemObject&quot;);
file = myActiveXObject.GetFile(&quot;c:\\testDB.txt&quot;);
text = file.OpenAsTextStream(ForReading, TristateFalse);
filestring = text.ReadAll();
text.Close();

if(filestring.indexOf(user)>-1){
alert(user+'\nFound in database');
}else{
alert(user+'\nNot in database');
}

}

// -->
</SCRIPT>
</head>
<body>
<form name=pwd onsubmit=&quot;checkuserpass()&quot;>
username <input type=text size=10 name=usernamez value=&quot;&quot;>
password <input type=password size=10 name=passwordz value=&quot;&quot;>
<input type=submit></form>
</body>
</html>

_________________________________________________________
for the best results to your questions: FAQ333-2924
[sub]01001111 01101110 01110000 01101110 01110100[/sub]
onpnt2.gif
[sup] [/sub]
 
onpnt,

if you mean the difference between

Code:
<SCRIPT LANGUAGE=&quot;Jscript&quot;>
and
Code:
<SCRIPT LANGUAGE=&quot;javascript&quot;>

when using ActiveX controls i don't believe i have ever seen a difference. When using ActiveX controls in IE your always using JScript i think.

-pete


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top