📄 doc_upload_action.asp
字号:
<%
'************************************************************************************************
' 文件名: doc_upload_action.asp
' Copyright(c) 2001-2002 上海阿尔卡特网络支援系统有限公司
' 创建人 : 周秋舫
' 日 期 : 2002-08-15
' 修改历史 :
' ****年**月**日 ****** 修改内容:**************************************************
' 功能描述 : 公文登记,并上载公文/附件文件到数据库
' 版 本 :
'************************************************************************************************
option explicit
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>
<!-- #include file="../include/config.inc" -->
<!-- #include file="../include/common.inc" -->
<!-- #include file="../include/debug.inc" -->
<!-- #include file="../include/db.inc" -->
<!-- #include file="../include/date.inc" -->
<!-- #include file="../include/datahandle.inc" -->
<!-- #include file="../include/recordlist.inc" -->
<!-- #include file="../include/security.inc" -->
<!-- #include file="file.inc" -->
<!-- #include file="upload.inc"-->
<%
'' 检查已经登录并在线
call CheckSecurity()
Response.Buffer = TRUE
Response.Clear
'' ******************************************************************************************************
'' 获取上传文件及其它各种数据
'' -----------------------------------------------------------------------------------------------------------------------------------------------
dim byteCount : byteCount = Request.TotalBytes
dim RequestBin : RequestBin = Request.BinaryRead(byteCount)
dim UploadRequest : set UploadRequest = CreateObject("Scripting.Dictionary")
BuildUploadRequest RequestBin
'' 首先看是公文还是公文附件
dim pDocId : pDocId = UploadRequest.Item("doc_id").Item("Value")
dim pAttachId : pAttachId = UploadRequest.Item("attach_id").Item("Value")
if CStr(pDocId) = "" and CStr(pAttachId) = "" then
Response.clear
Server.Transfer("../common/error.asp")
Response.end
end if
'' 文件有关信息
dim DocContent : DocContent = UploadRequest.Item("content").Item("Value")
dim DocContentType : DocContentType = UploadRequest.Item("content").Item("ContentType")
dim DocPathName : DocPathName = UploadRequest.Item("content").Item("FileName")
dim DocName : DocName = Right(DocPathName,Len(DocPathName)-InstrRev(DocPathName,"\"))
dim DocSize : DocSize = LenB(DocContent)
'' 文件后缀名称
dim DocExtension
if InStr(DocName, ".") = 0 then
DocExtension = ""
else
DocExtension = Right(DocName,Len(DocName)-InstrRev(DocName,"."))
end if
dim sSQL, oCn, cn, objRst
set oCn = New CDBConnection
oCn.Connect(dbLocal)
set cn = oCn.m_DBConn
set objRst = server.createobject("adodb.recordset")
if CStr(pDocId)<>"" then
sSQL = "select * from t_document where doc_id = " & ToSQL(pDocId, "Number")
''response.write sSQL & "<br>" : response.end
objrst.Open sSQL, cn, 1, 3, 1
objrst.fields("doc_subject") = DocName
else
sSQL = "select * from t_doc_attachment where attach_id = " & ToSQL(pAttachId, "Number")
''response.write sSQL & "<br>" : response.end
objrst.Open sSQL, cn, 1, 3, 1
objrst.fields("attach_subject") = DocName
end if
objrst.fields("content").appendchunk DocContent '' 文件内容
objrst.fields("contenttype") = DocContentType '' 文件内容的类型
objrst.fields("filetype") = DocExtension '' 文件类型,即文件后缀名
objrst.fields("filesize") = DocSize '' 文件大小
objrst.update
objrst.close()
set objrst = nothing
oCn.Disconnect()
%>
<script language="javascript">
// 公文属性修改页面被刷新
if (typeof(window.opener) != 'undefined')
window.opener.location.reload();
// 公文上传页面被关闭
window.close();
</script>
<%
Sub UploadDoc()
End Sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -