Obtém um arquivo e retorna um objeto File.
O FileName pode ser um caminho absoluto ou relativo.
Function GetFile(ByVal FileName)
On Error Resume Next
If Mid(FileName, 2, 1) <> ":" Then
FileName = Server.MapPath(FileName)
End If
If Err Then Err.Clear
On Error GoTo 0
Dim FSO
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
On Error Resume Next
Set GetFile = FSO.GetFile(FileName)
If Err Then
Err.Clear
Set GetFile = Nothing
End If
On Error GoTo 0
Set FSO = Nothing
End Function
Nenhum comentário:
Postar um comentário