注册 登录
编程论坛 ASP技术论坛

[求助]FSO 文件如何改成ADODB.Stream

ali218 发布于 2007-10-13 19:25, 947 次点击

下面的FSO 文件,如何改成ADODB.Stream呢,因为我要生成UTF-8格式文件
请高手帮忙
(是新云的include/collection.asp)


'================================================
'函数名:CreatedPathEx
'作 用:FSO创建多级目录
'参 数:LocalPath ----原文件路径
'返回值:False ---- True
'================================================
Public Function CreatedPathEx(ByVal sPath)
sPath = Replace(sPath, "/", "\")
sPath = Replace(sPath, "\\", "\")
On Error Resume Next

Dim strHostPath,strPath
Dim sPathItem,sTempPath
Dim i,fso

Set fso = Server.CreateObject("Scripting.FileSystemObject")
strHostPath = Server.MapPath("/")
If InStr(sPath, ":") = 0 Then sPath = Server.MapPath(sPath)
If fso.FolderExists(sPath) Or Len(sPath) < 3 Then
CreatedPathEx = True
Exit Function
End If

strPath = Replace(sPath, strHostPath, vbNullString,1,-1,1)
sPathItem = Split(strPath, "\")

If InStr(LCase(sPath), LCase(strHostPath)) = 0 Then
sTempPath = sPathItem(0)
Else
sTempPath = strHostPath
End If

For i = 1 To UBound(sPathItem)
If sPathItem(i) <> "" Then
sTempPath = sTempPath & "\" & sPathItem(i)
If fso.FolderExists(sTempPath) = False Then
fso.CreateFolder sTempPath
End If
End If
Next
Set fso = Nothing
If Err.Number <> 0 Then Err.Clear
CreatedPathEx = True
End Function

'--删除文件
Public Function DeleteFiles(ByVal sFilePath)
On Error Resume Next
Dim fso
Set fso = Server.CreateObject("Scripting.FileSystemObject")
fso.DeleteFile sFilePath, True
DeleteFiles = True
Set fso = Nothing
Exit Function
End Function

5 回复
#2
yms1232007-10-13 21:24
ADODB.Stream个人所知读写文件没什么问题,删除文件应该是不行。
#3
ali2182007-10-15 16:53
那该怎么修改呢,麻烦你把读写的部分改一下好吗
#4
ali2182007-10-25 18:27
#5
yms1232007-10-25 19:29

楼主提供的是创建目录的代码,ADODB.Stream创建目录操作个人还没写过。

#6
ali2182007-10-30 19:28
好的,谢谢,我以为是生成HTML的文件
1