yamoo
12-16-2004, 06:49 PM
Hello, Is there any way to check if a file exists (Like exe's, images, html docs, etc) with Javascript?
|
||||
How can JS check if a file exists?yamoo 12-16-2004, 06:49 PM Hello, Is there any way to check if a file exists (Like exe's, images, html docs, etc) with Javascript? requestcode 12-16-2004, 07:00 PM No. Javascript is not capable of that. You will have to use a Server Side language such as Perl, PHP, ASP or Java. glenngv 12-17-2004, 01:42 AM Yes, through XMLHTTP object. Something similar to this (http://www.codingforums.com/showthread.php?t=14463), you just need to check if the HTTP status is 404 or not. But server-side solution might be more appropriate for your situation. styeung 12-17-2004, 01:23 PM Please try the following script: var fso = new ActiveXObject("Scripting.FileSystemObject"); filename="test.txt"; if (fso.FileExists(filename)){ // file exists } |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum