Entry
How do I check whether a file exists say c:\temp\MyFile.txt. in a client PC using Javascript
Jul 16th, 2004 14:22
Geir Pedersen, Jean-Bernard Valentaten, Prakash prakash,
Javascript has built in security that limits what files you can access.
Basically this security works so that you can only access files on the
same server as the Javascript was loaded from. If your users load the
Javascript from your webserver, the Javascript can only open URLs/files
on your webserver. Likewise, if the Javascript is loaded from the users
local harddrive, the Javascript will be able to open files on the
harddrive.
The most general way to open a file from a Javascript is to use the DOM
to create an Iframe, load the file into the Iframe and then access the
content of the file via the DOM.