'檢查某一文件是否存在 Function CheckFile(FilePath) Dim fso 'Filepath=Server.MapPath(FilePath) '網站相對路徑 Set fso = Server.CreateObject("Scripting.FileSystemObject") '網絡絕對路徑 If fso.FileExists(FilePath) then '存在 CheckFile = True Else '不存在 CheckFile = False End if Set fso = nothing End Function
'檢查目錄是否存在 Function CheckDir(FolderPath) dim fso 'folderpath=Server.MapPath(".")&"\"&folderpath '網站相對路徑 Set fso = Server.CreateObject("Scripting.FileSystemObject") '網絡絕對路徑 If fso.FolderExists(FolderPath) then '存在 CheckDir = True Else '不存在 CheckDir = False End if Set fso = nothing End Function
<% '------------------------- '--創建目錄 網站相對路徑 '---------------------- Function MakeNewsDir(byval foldername) dim fso Set fso = Server.CreateObject("Scripting.FileSystemObject") fso.CreateFolder(Server.MapPath(foldername)) If fso.FolderExists(Server.MapPath(foldername)) Then MakeNewsDir = True Else MakeNewsDir = False End If Set fso = nothing End Function %>
'------------------------- '--創建目錄 網絡絕對路徑 '---------------------- Function MakeNewsDir(byval foldername) dim fso2 Set fso2 = Server.CreateObject("Scripting.FileSystemObject") fso2.CreateFolder(up_SavePath) If fso.FolderExists(up_SavePath) Then MakeNewsDir = True Response.Write("目錄已創建"& "<BR>") Else MakeNewsDir = False Response.Write("目錄未創建"& "<BR>") End If Set fso2 = nothing End Function