[thelist] ASP: FileSystemObject.FileExists
Maximillian Schwanekamp
anaxamaxan at neptunewebworks.com
Wed Apr 14 16:31:16 CDT 2004
>What am I doing wrong?
You need to use the local file path, not the external URL. Server.MapPath
is useful for this:
<%
Function CheckFileExists(sFileName)
Dim fso
Set fso = Server.CreateObject("Scripting.FileSystemObject")
CheckFileExists = (fso.FileExists(sFileName))
Set fso = Nothing
End Function
If CheckFileExists(Server.MapPath("/~test/art/port/41_1.jpg")) then
Response.Write("file is there")
Else
Response.Write("file is not there")
End If
%>
There are scads of ASP/VB resources, but I have found DevGuru's quick
references most handy for this. They sell a downloadable version for $10.
http://devguru.com/Technologies/vbscript/quickref/vbscript_intro.html
Maximillian Von Schwanekamp
NeptuneWebworks.com
voice: 541-302-1438
fax: 208-730-6504
More information about the thelist
mailing list