[thelist] ASP: FileSystemObject.FileExists

Casey Crookston casey at thecrookstons.com
Wed Apr 14 16:08:04 CDT 2004


I'm trying to use FileSystemObjects to see if a picture exists.  If it
does... show it.  If not, show a "Picture not available" pic.  But, even if
the pic DOES exist my script seem seems to think it doesn't.

What am I doing wrong?

<%
Function CheckFileExists(sFileName)
 Dim FileSystemObject
 Set FileSystemObject = Server.CreateObject("Scripting.FileSystemObject")
 If (FileSystemObject.FileExists(sFileName)) Then
  CheckFileExists = True
 Else
  CheckFileExists = False
 End If
 Set FileSystemObject = Nothing
End Function

If
CheckFileExists("http://www.boserconstruction.com/~test/art/port/41_1.jpg")
Then
Response.Write("file is there")
Else
Response.Write("file is not there")
End If
%>




More information about the thelist mailing list