Jul 04 2004

ASP Checking if a file exists

Posted by admin under Filehandling

<%
Function File_Exists( strPath )
Dim objFileObj, objFile
On Error Resume Next
File_Exists = False

Set objFileObj = Server.CreateObject("Scripting.FileSystemObject")
Set objFile = objFileObj.OpenTextFile (strPath, File_OpenForReading)

If Err = 0 Then
File_Exists = True
End If
End Function
%>