📄 doc_upload_action.asp
字号:
<%
'************************************************************************************************
' 文件名: doc_upload_action.asp
' Copyright(c) 2001-2002 上海阿尔卡特网络支援系统有限公司
' 创建人 : 周秋舫
' 日 期 : 2002-08-15
' 修改历史 :蔡晓燕
' 2002年11月19日 ****** 修改内容:**************************************************
' 功能描述 :添加附件文件到数据库
' 版 本 :
'************************************************************************************************
option explicit
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>
<!-- #include file="../include/common.inc" -->
<!-- #include file="../include/file.inc" -->
<!-- #include file="../include/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 pAttachId : pAttachId = UploadRequest.Item("attach_id").Item("Value")
if pAttachId = 0 then
dim iPlanId : iPlanId = UploadRequest.Item("plan_id").Item("Value")
dim pEquiSysId : pEquiSysId = UploadRequest.Item("equi_sys_id").Item("Value")
dim pObjectType : pObjectType = UploadRequest.Item("object_type").Item("Value")
end if
if CStr(pAttachId) = "" then
Response.clear
Server.Transfer("../include/error.asp")
Response.end
end if
if hasright(ID_EQUIPMENT) < RIGHT_WRITE then
Response.Write _
"<script language=""javascript"">" & vbLF & _
" alert(""对不起,您没有上传维保附件的权限(您的角色没有设备更新的权限)!"");" & vbLF & _
"</script>" & vbLF
%>
<script language="javascript">
// 重新load维保信息修改页面
window.location.href="updatesysplan.asp?objecttype=<%=pObjectType%>&id=<%=pEquiSysId%>";
</script>
<%
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, conn, objRst
Set conn = DBConnection
set objRst = server.createobject("adodb.recordset")
if pAttachId = 0 then
'上传附件
objrst.Open "t_maintain_attachment", conn, 1, 3, 2
objrst.AddNew
objrst.fields("plan_id") = iPlanId
objrst.fields("attach_name") = DocName
objrst.fields("content").appendchunk DocContent '' 文件内容
objrst.fields("content_type") = DocContentType '' 文件内容的类型
objrst.fields("file_type") = DocExtension '' 文件类型,即文件后缀名
objrst.fields("file_size") = DocSize '' 文件大小
objrst.update
else
'重传附件
sSQL = "select * from t_maintain_attachment where attach_id = " & ToSQL(pAttachId, "Number")
objrst.Open sSQL, conn, 1, 3, 1
objrst.fields("attach_name") = DocName
objrst.fields("content").appendchunk DocContent '' 文件内容
objrst.fields("content_type") = DocContentType '' 文件内容的类型
objrst.fields("file_type") = DocExtension '' 文件类型,即文件后缀名
objrst.fields("file_size") = DocSize '' 文件大小
objrst.update
end if
objrst.close()
set objrst = nothing
Disconnect(conn)
%>
<script language="javascript">
// 维保计划修改页面被刷新
if (typeof(window.opener) != 'undefined') {
window.opener.location.reload();
window.close();
}
else
window.location.href="updatesysplan.asp?objecttype=<%=pObjectType%>&id=<%=pEquiSysId%>";
// 附件上传页面被关闭
</script>
<%
Sub UploadDoc()
End Sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -