stm=Server.CreateObject("adodb.stream")
stm.Type=1 ''adTypeBinary,按二进制数据读入
stm.Mode=3 ''adModeReadWrite ,这里只能用3用其他会出错
stm.Open
stm.LoadFromFile Server.MapPath(filePath)
stm.Position=0 ''把指针移回起点
stm.Type=2 ''文本数据
stm.Charset="utf-8"
ReadFile = stm.ReadText
stm.Close
set stm=nothing
End Function
''检测文件是否存在
Function ReportFileStatus(FileName)
set fso = server.createobject("scripting.filesystemobject")
if fso.fileexists(FileName) = true then
ReportFileStatus=true
else
ReportFileStatus=false
end if
set fso=nothing
end function
''检测目录是否存在
function tesfold(foname)
set fs=createobject("scripting.filesystemobject")
filepathjm=server.mappath(foname)
if fs.folderexists(filepathjm) then
tesfold=True
else
tesfold= False
end if
set fs=nothing
end function
''建立目录
sub createfold(foname)
set fs=createobject("scripting.filesystemobject")
fs.createfolder(foname)
set fs=nothing
end sub
''删除文件
function del_file(path) ''path,文件路径包含文件名
set objfso = server.createobject("scripting.FileSystemObject")
''path=Server.MapPath(path)
if objfso.FileExists(path) then ''若存在则删除
objfso.DeleteFile(path) ''删除文件
else
''response.write "<script language=''Javascript''>alert(''文件不存在'')</script>"
end if
set objfso = nothing
end function
%>