求高手帮忙急,按月份自动创建上传文件夹程序有错误,求解?万分感谢,急!!!
'按月份自动明名上传文件夹,需要FSO组件支持。Private Function CreatePath()
Dim objFSO,uploaderPath,TempPath,m
MyMonth = Month(Now())
MyDay = Day(Now())
IF Len(MyMonth) = 1 Then MyMonth = "0"&MyMonth
IF Len(MyDay) = 1 Then MyDay = "0"&MyDay
uploaderPath=year(now)&"-"&MyMonth '以年月创建上传文件夹,格式:2003-8
TempPath = Array(Server.MapPath(Config.ImagePath(0)&uploaderPath&"/"&MyDay),_
Server.MapPath(Config.ImagePath(0)&uploaderPath),_
Server.MapPath(Config.ImagePath(1)&uploaderPath&"/"&MyDay),_
Server.MapPath(Config.ImagePath(1)&uploaderPath),_
Server.MapPath(Config.ImagePath(2)&uploaderPath&"/"&MyDay),_
Server.MapPath(Config.ImagePath(2)&uploaderPath))
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
With objFSO
For m = 0 To Ubound(TempPath) Step 2
If Not .FolderExists(TempPath(m)) Then
If Not .FolderExists(TempPath(m+1)) Then
.CreateFolder TempPath(m+1) //提示这行有错误
End If
.CreateFolder TempPath(m)
End If
Next
End With
If Err.Number = 0 Then
CreatePath=uploaderPath&"/"&MyDay&"/"
Else
CreatePath=""
End If
Set objFSO = nothing
End Function
[ 本帖最后由 hhhcmp 于 2010-11-16 14:12 编辑 ]