View Full Version : File Exists
pwgeary
06-18-2003, 07:01 AM
is there any way to Detect Whether a File Exists or Not on another server. This does not seem to work.
<%
Set fs = Server.CreateObject( "Scripting.FileSystemObject" )
IF fs.FileExists( "http://www.programmersresource.com/forum/images/vBulletin_logo.gif" ) THEN
Response.Write "File Exists!"
ELSE
Response.Write "File Doesn't Exist!"
END IF
%>
Thanks
Paul
I'm not sure of the answer to this one, but I can explain why that doesn't work.
server.createobject happens on the server in which the object is instantiated. So, if you invoke the FSO, it will happen on the in which it was invoked. It does not perform remote file checking.
jsawkang
06-18-2003, 07:16 AM
here a good sample code
http://www.aspalliance.com/brettb/FileAndFolderCheckers.asp
Great link for use of the FSO, but again, the FSO is ONLY used on the server in which it is invoked on. He wants to find out if a file exists on a remote server.
pwgeary
06-18-2003, 08:49 AM
Yes i am looking to check to see if a file exists on a remote server.
Thanks for your input
paul
viper27
06-18-2003, 10:23 AM
I would suggest that if you are using an HTTP request (like in your example) you would want to open a GET request and check for the error code. While I have never done this myself, this would be the approach I would take, using the Microsoft internet controls (shdocvw.dll).
vBulletin v3.0.3, Copyright ©2000-2012, Jelsoft Enterprises Ltd.