TSYS2.0文件不可以生成修正 :: 人民需要艺术,艺术需要交流!
artscn · 13zhang · 2006-03-09
人民需要艺术,艺术需要交流!
开始记录我的思想,不能因为它们与众不同而感到羞耻!
<< ~TSYS2.0线上指导~
|
首页
|
用asp水印图片代码和方法 >>
2006-03-09
TSYS2.0文件不可以生成修正
官方版本。在配置之后添加资源会出现文件不可以生成的错误
Microsoft VBScript 运行时错误 错误 ''800a003a''
文件已存在
/admin/manage/inc/FunctionLib.class.asp,行293
''函数:创建完整目录
''参数:目录串
Public Function createFolder(strPath)
strPath = Replace(strPath,"/", "\")
arrPath = Split(strPath, "\")
Dim Fso, I, tmpPath, arrPath
Set Fso = Server.createObject(Cfg.FileSystemObject_Name)
tmpPath = arrPath(0)
For I=1 To UBound(arrPath)
tmpPath = tmpPath & "\" & arrPath(I)
If Not Fso.FolderExists(tmpPath) Then ''判断文件夹是否存在,否则创建
Fso.createFolder tmpPath ''293行
End If
Next
End Function[/code]
可以看到FunctionLib.class.asp行293所在是创建完整目录的函数,这是生成HTML不可少的部分,从上面的代码注释可见作者已经想到的,但是文件夹判断上有错误,应该是忽略了最上的目录,所以判断出了问题,继续执行执行建立文件夹。此时,FSO组件会发现该路径已存在,我做了个小的修改,修正不可以生成的问题,以下是代码,覆盖以上可以了,本人测试通过的。。
''函数:创建完整目录
''参数:目录串
Public Function createFolder(strPath)
Dim Fso, I, tmpPath, arrPath ,PathTMP
On Error Resume Next
strPath = Replace(strPath,"\", "/")
Set Fso = Server.createObject(Cfg.FileSystemObject_Name)
arrPath = Split(strPath, "/")
tmpPath = arrPath(0)
For I=0 To UBound(arrPath)
If I=0 Then PathTMP=arrPath(0) & "/" Else PathTMP=PathTMP&arrPath(I) & "/"
tmpPath = Left(PathTMP,Len(PathTMP)-1)
If Not Fso.FolderExists(tmpPath) Then
Fso.createFolder(tmpPath)
End If
Next
End Function
不过我也很纳闷一个问题,就是编辑原有的资源可以生成?? 不知道原因,有高手可以指点一二,感激。
转载请注明出处:
13zhang
引用Trackback(0)
|
编辑
评论
最后更新
发表评论
原始快照:web.archive.org