|
|
|
|
|
| | |
|
Active Server Pages ASP a directory of ASP tutorials applications scripts components and articles for the novice to professional developer. CJWSoft ASPProtect ASPBanner ASPClassifieds
(Advanced)
(Components)
(Database)
(General)
(Vbscript)

|
|
Subject: |
File Exists |
From: |
Tim |
Date: |
11/16/1999 7:50:03 AM |
IP: |
207.51.162.13 |
You can use the file system object. Heres a function that checks for the existance of a file and returns True or False:
Function FileFound(FileName)
Dim FileObj
FileFound = True
Set fs = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
Set FileObj = fs.OpenTextFile(Server.MapPath(FileName), 1, False, 0)
If Err.Number <> 0 Then
Err.Clear
FileFound = False
Exit Function
End If
FileObj.Close
Set fs = Nothing
End Function
Example:
Response.Write(FileFound("test.txt"))
If you need to use physical paths then remove the "Server.MapPath()".
|
Previous Message
|
|
|
|
|
|
|
|
|
|
|
|