rs("ViewNum") = rs("ViewNum") + 1
downloadFile Server.MapPath(rs(0)),0
downloadFile Server.MapPath(Replace(Path,blogurl,"")),1
downloadFile Server.MapPath(Path),1
'如果附件为图片的话,当权限检验无法通过则调用一默认图片,防止<img>标记无法调用,影响显示效果
Response.Write ShowDownErr
downloadFile Server.MapPath(blogdir&"images/oblog_powered.gif"),1
Sub downloadFile(strFile,stype)
Server.ScriptTimeOut=9999999
Dim S,fso,f,intFilelength,strFilename
Set s = Server.CreateObject(oblog.CacheCompont(2))
Set fso = Server.CreateObject(oblog.CacheCompont(1))
If Not fso.FileExists(strFilename) Then
Response.Write "该附件已经被删除!"
strFilename = Server.MapPath(blogdir&"images/nopic.gif")
Set f = fso.GetFile(strFilename)
s.LoadFromFile(strFilename)
Response.Write("<h1>错误: </h1>" & Err.Description & "<p>")
select Case LCase(Right(strFile, 4))
ContentType = "video/x-ms-asf"
ContentType = "video/avi"
ContentType = "application/msword"
ContentType = "application/zip"
ContentType = "application/vnd.ms-excel"
ContentType = "image/gif"
ContentType = "image/jpeg"
ContentType = "audio/wav"
ContentType = "audio/mpeg3"
ContentType = "video/mpeg"
ContentType = "application/rtf"
ContentType = "text/html"
ContentType = "text/plain"
ContentType = "application/octet-stream"
If Response.IsClientConnected Then
If Not (InStr(LCase(f.name),".gif")>0 or InStr(LCase(f.name),".jpg")>0 or InStr(LCase(f.name),".jpeg")>0 or InStr(LCase(f.name),".bmp")>0 or InStr(LCase(f.name),".png")>0 )Then
Response.AddHeader "Content-Disposition", "attachment; filename=" & f.name
Response.AddHeader "Content-Length", intFilelength
Response.CharSet = "UTF-8"
Response.ContentType = ContentType
Response.BinaryWrite Data
If oblog.CacheConfig(67) = "1" Then
If oblog.ChkPost = False Then
If oblog.CheckUserLogined = False Then
If oblog.CacheConfig(82) = "0" Then
ShowDownErr = "游客无浏览附件权限"
If uid = oblog.l_uid Then
If oblog.l_Group(35,0) = "0" Then
ShowDownErr = "当前用户组无浏览附件权限"
If oblog.CacheScores(21) >"0" Then
If oblog.l_uScores < Int(oblog.CacheScores(21)) Then
ShowDownErr = "积分不足,无浏览附件权限"
oblog.GiveScore "",-1*Abs(oblog.CacheScores(21)),""
Session ("CheckUserLogined_"&oblog.l_uName) = ""
ShowDownErr = Err.Description