⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 content_show.asp

📁 物业管理和办公自动化系统
💻 ASP
字号:
<%
'************************************************************************************************
' 文件名: showcontent.asp
' Copyright(c) 2001-2002 上海阿尔卡特网络支援系统有限公司

'  创建人 : 周秋舫
'  日 期 : 2002-08-16
' 修改历史 :
'   ****年**月**日 ****** 修改内容:**************************************************
' 功能描述 : 查看或下载公文文件/公文附件的内容,文件内容信息是从数据库获取的
'  版 本 :
'************************************************************************************************
option explicit
'Response.CacheControl = "no-cache"
'Response.AddHeader "Pragma", "no-cache"
'Response.Expires = -1
%>

<!-- #include file="../include/common.inc" -->
<!-- #include file="../include/db.inc" -->
<!-- #include file="../include/datahandle.inc" -->
<!-- #include file="../include/security.inc" -->

<%
call CheckSecurity()

'' 只有公文管理员或办公室主任或具有公文查询权限的人员才能访问本页
if (not IsDocAdmin) and (not IsOfficer) and (not HasRightToDocInfor) then
	Response.Clear
	Response.Redirect("../common/error.asp?error=对不起,您没有权限访问本页!&")
	Response.end
end if

dim pDocId		: pDocId = GetParam("doc_id")
dim pAttachId	: pAttachId = GetParam("attach_id")
if IsEmpty(pDocId) and IsEmpty(pAttachId) then
	Response.Clear
	Server.Transfer("../common/error.asp")
	Response.end
end if

dim sSQL, crs, rs
if IsEmpty(pDocId) then	'' 公文附件
	sSQL = "select attach_subject as filename, contenttype, content from t_doc_attachment where attach_id = " & ToSQL(pAttachId, "Number")
else								'' 公文
	sSQL = "select doc_subject as filename, contenttype, content from t_document where doc_id = " & ToSQL(pDocId, "Number")
end if
set crs = New CRecordset
set rs = crs.Open(dbLocal, sSQL)

'' 如果找不到查询符合条件的文件,则跳转到出错页面
if rs.eof then
	Response.Clear()
	Server.Transfer("../common/error.asp")
	Response.end
end if

'' 写文件内容
Response.ContentType = crs.GetValue("contentType")
Response.BinaryWrite crs.GetValue("content")
crs.Close()
' 设置响应头和下载保存的文件名 
'dim filename	: filename = crs.GetValue("filename")
'Response.AddHeader "Content-Disposition","attachment;filename=" & filename 
'Response.ContentType = "APPLICATION/OCTET-STREAM"
'Response.BinaryWrite crs.GetValue("content")
'crs.Close()
%> 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -