【www.gdgbn.com--安卓教程】


"==============================
 "函 数 名:CreateFolder
 "作    用:创建文件夹
 "参    数:文件夹相对路径FolderPath
 "==============================
 Function CreateFolder(FolderPath)
"  On Error Resume Next
  Set Fso=Server.CreateObject("Scri"&"pting.File"&"Sys"&"temObject")
  Set F=Fso.CreateFolder(Server.MapPath(FolderPath))
  CreateFolder=F.Path
  Set F=Nothing
  Set Fso=Nothing
"  Select Case Err
"   Case 424 Response.Write("方卡错误提示:创建"&FolderPath&"文件夹时,路径未找到或者该目录没有写入权限!")
"  End Select
 End Function
 
 "==============================
 "函 数 名:CreateFile
 "作    用:创建文件
 "参    数:文件相对路径FilePath,文件内容FileContent
 "==============================
 Function CreateFile(FilePath,FileContent)
"  On Error Resume Next
  Dim Temps
  Temps=""
  TempArr=Split(FilePath,"/")
  For i=0 to UBound(TempArr)-1
   If Temps="" Then
    Temps=TempArr(i)
   Else
    Temps=Temps&"/"&TempArr(i)
   End If
   If IsFolder(Temps)=False Then
    Call CreateFolder(Temps)
   End If
  Next
  Set objAdoStream = Server.CreateObject("A"&"dod"&"b.St"&"r"&"eam")
  objAdoStream.Type = 2
  objAdoStream.Charset = "UTF-8"
  objAdoStream.Open
  objAdoStream.WriteText = FileContent
  objAdoStream.SaveToFile Server.MapPath(FilePath),2
  objAdoStream.Close()
  Set objAdoStream = Nothing
"  Select Case Err      
"    Case 424 Response.Write("方卡错误提示:创建"&FilePath&"文件时,路径未找到或者该目录没有写入权限!")
"  End Select
 End Function

本文来源:http://www.gdgbn.com/shoujikaifa/20750/