📄 readdoc.asp
字号:
<%@ Language=VBScript %>
<!--#include file="conn.asp"-->
<%
'从数据库中读取在线编辑的文件数据
docid = Request.querystring("docid")
Dim RS
Set RS = Server.CreateObject("ADODB.Recordset")
if docid <> "" then
RS.Open "files", conn, adOpenStatic, adLockReadOnly 'open static for search,read only
RS.Find "fid=" & docid
If Not RS.EOF THEN
FileSize = RS("fcontent").ActualSize
Response.AddHeader "Content-Disposition","attachment; filename=" & RS("fname")
Response.AddHeader "Content-Length","" & FileSize
readBytes = 0
ReadSize = 10240
Do While readBytes < FileSize
Response.BinaryWrite(RS("fcontent").GetChunk(ReadSize))
Response.Flush()
readBytes = readBytes + ReadSize
Loop
end if
ELSE
docid = Request.querystring("tid")
RS.Open "templates", conn, adOpenStatic, adLockReadOnly 'open static for search,read only
RS.Find "tid=" & docid
If Not RS.EOF THEN
FileSize = RS("tcontent").ActualSize
Response.AddHeader "Content-Disposition","attachment; filename=" & RS("tname")
Response.AddHeader "Content-Length","" & FileSize
readBytes = 0
ReadSize = 10240
Do While readBytes < FileSize
Response.BinaryWrite(RS("tcontent").GetChunk(ReadSize))
Response.Flush()
readBytes = readBytes + ReadSize
Loop
END IF
end if
RS.Close
Set Rs= Nothing
Closeconn()
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -