最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

ASP檢查文件與目錄是否存在的函數(shù)代碼

 更新時間:2020年09月14日 23:54:18   投稿:mdxy-dxy  
第一個函數(shù)CheckDir,用于判斷所指定的文件夾是否存在,也就是目錄是否存在;第二個函數(shù)CheckFile用于檢查指定文件是否存在在于某個目錄中

以下為兩個自寫的ASP函數(shù),第一個函數(shù)CheckDir,用于判斷所指定的文件夾是否存在,也就是目錄是否存在;第二個函數(shù)CheckFile用于檢查指定文件是否存在在于某個目錄中。

兩個函數(shù)都是基于ASP中的FileSystemObject對象,也就是FSO,寫成函數(shù)方便以后使用。

ASP檢查目錄是否存在的函數(shù)代碼

Function CheckDir(Byval 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 isExistFolder(Byval folderDir)
	on error resume next
	If objFso.FolderExists(server.MapPath(folderDir)) Then isExistFolder=True Else isExistFolder=False
	if err then err.clear:isExistFolder=False
End Function

ASP檢查文件是否存在的函數(shù)代碼

Function CheckFile(Byval 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 isExistFile(Byval fileDir)
	on error resume next
	If (objFso.FileExists(server.MapPath(fileDir))) Then isExistFile=True Else isExistFile=False
	if err then err.clear:isExistFile=False
End Function

下面是其他網(wǎng)友的補充

'================================================== 
'函數(shù)名: CheckFile 
'作 用:檢查某一文件是否存在 
'參 數(shù):FileName ------ 文件地址 如:/swf/1.swf 
'返回值:False ---- True 
'================================================== 
  Public Function CheckFile(FileName) 
     On Error Resume Next 
     Dim FsoObj 
     Set FsoObj = Server.CreateObject("Scripting.FileSystemObject") 
     If Not FsoObj.FileExists(Server.MapPath(FileName)) Then 
       CheckFile = False 
       Exit Function 
     End If 
     CheckFile = True:Set FsoObj = Nothing 
  End Function

到此這篇關(guān)于ASP檢查文件與目錄是否存在的函數(shù)代碼的文章就介紹到這了,更多相關(guān)asp文件是否存在內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論

章丘市| 上饶市| 富宁县| 祁东县| 高陵县| 深水埗区| 新民市| 绵竹市| 弥勒县| 河东区| 溧水县| 南城县| 保德县| 曲靖市| 遂溪县| 巫溪县| 富裕县| 营山县| 苍梧县| 菏泽市| 交口县| 珠海市| 庆安县| 甘洛县| 左云县| 措勤县| 天津市| 五常市| 巢湖市| 抚州市| 巨野县| 富民县| 富源县| 韩城市| 清涧县| 大厂| 高尔夫| 和田县| 兴义市| 云安县| 敦化市|