📄 upgongwenpost.asp
字号:
<%
Response.ExpiresAbsolute=now()-1
Response.CacheControl="no-cache"
%>
<%
'在页头写:
Dim StartTime,EndTime
StartTime=timer() '创建一个计时器,单位:毫秒,页面开始执行时间
%>
<%server.ScriptTimeout=1800%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="../../index.asp"
MM_grantAccess=false
If Session("userssdfgfhtrh") <> "" Then
If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%><!--#include file="../../Connections/leq.asp" -->
<!--#include file="../../Connections/oavbsconn.asp" -->
<!--#include FILE="upload_5xsoft.inc"-->
<!--#include file="../../Connections/ifr/ifrasp.asp" -->
<html>
<head>
<title></title>
<style type="text/css">
<!--
td { font-size: 12px; line-height: 17px }
body { font-size: 12px; line-height: 17px }
p { margin-top: 1; margin-bottom: 1 }
a:link { text-decoration: none; color: black }
a:visited { text-decoration: none; color: black }
a:hover { text-decoration: underline; color: red }
-->
</style>
<link href="../../css/input.css" rel="stylesheet" type="text/css">
<link href="../../css/link.css" rel="stylesheet" type="text/css">
</head>
<body>
<img src="../../toall/jfoanet/img/978.gif" width="27" height="24">文件上传
<hr size=1 color="#0066FF" noshadow width=700 align=left>
<br><br>
<%
Server.ScriptTimeout=900
dim upload,file,formName,formPath,iCount,fileformat
set upload=new upload_5xSoft
%>
<%if upload.form("接收部门")="" then %>
<script language="javascript">
{
alert("请您选择接收对象!");history.go(-1)
}
</script>
<%response.end
end if%>
<%if upload.form("标题")="" then %>
<script language="javascript">
{
alert("请输入标题!");history.go(-1)
}
</script>
<%response.end
end if%>
<%
if upload.form("filepath")="" then ''得到上传目录
HtmEnd "请输入要上传至的目录!"
set upload=nothing
response.end
%>
<%
else
formPath=upload.form("filepath")
gongwenleixing=upload.form("公文类型")
gongwenbiaoti=upload.form("标题")
gongwengaiyao=upload.form("公文概要")
jieshoubumen=upload.form("接收部门")
session("huizhi")=upload.form("huizhi")
session("jieshoubumen")=jieshoubumen
if right(formPath,1)<>"/" then formPath=formPath&"/"
end if
iCount=0
for each formName in upload.file
set file=upload.file(formName)
fileformat="."&Mid(file.filename,InStrRev(file.filename,".")+1)
fileformatxz="."&Mid(file.filename,InStrRev(file.filename,".")+1)
%>
<!--#include FILE="ftyepseesrfgtsf.asp"-->
<%
dim flength,fpath,fname
if file.FileSize>0 then
flength=cint(file.FileSize/1024)
fpath=formPath&File.FileName
fname=file.FileName
session("fnames")=fname
Dim datalog__MMColParam
datalog__MMColParam = "1"
If (file.FileName <> "") Then
datalog__MMColParam = file.FileName
End If
Dim datalog__vargeter
datalog__vargeter = "1"
If (upload.form("接收部门") <> "") Then
datalog__vargeter = upload.form("接收部门")
End If
Dim datalog
Dim datalog_numRows
Set datalog = Server.CreateObject("ADODB.Recordset")
datalog.ActiveConnection = MM_oavbsconn_STRING
datalog.Source = "SELECT * FROM 文件信息info WHERE 文件名 = '" + Replace(datalog__MMColParam, "'", "''") + "'"
datalog.CursorType = 0
datalog.CursorLocation = 3
datalog.LockType = 3
datalog.Open()
if not datalog.eof then
response.Redirect("wrong.asp")
end if
on error resume next
file.SaveAs Server.mappath(formPath&file.FileName) ''保存文件
if err.number<>0 then
response.write"<script>alert('"&Session("names")&"很抱歉,您上传的文件"&file.FileName&"含有,.;等非法字符,请去掉该类字符继续上传,谢谢!');location='"&request.ServerVariables("HTTP_REFERER")&"'</script>"
response.end()
end if
response.write file.FilePath&file.FileName&" ("&cint(file.FileSize/1024)&"K) => "&formPath&File.FileName&" 成功!<br>"
iCount=iCount+1
dim total
total=1
dim ks
ks="k"
Dim getmaxgongwenid
Dim getmaxgongwenid_numRows
Set getmaxgongwenid = Server.CreateObject("ADODB.Recordset")
getmaxgongwenid.ActiveConnection = MM_oavbsconn_STRING
getmaxgongwenid.Source = "SELECT max(id)+1 as themaxid FROM gongwenadmindfggrhb"
getmaxgongwenid.CursorType = 0
getmaxgongwenid.CursorLocation = 3
getmaxgongwenid.LockType = 3
getmaxgongwenid.Open()
%>
<%
do while total<=iCount and datalog.eof
datalog.addnew
datalog("邮件编号")=getmaxgongwenid("themaxid")
total=total+1
datalog("文件名")= fname
datalog("文件路径")=fpath
datalog("信息属性来源")="公文"
datalog("接收人")=upload.form("接收部门")
if flength=0 then
flength=1
end if
datalog("文件大小")=flength&"KB"
datalog.update
datalog_numRows = 0
loop
datalog.Close()
Set datalog = Nothing
end if
set file=nothing
next
set upload=nothing ''删除此对象
Htmend iCount&" 个文件上传结束!"
sub HtmEnd(Msg)
set upload=nothing
end sub
%>
<%dim huizhi
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_oavbsconn_STRING
Recordset1.Source = "SELECT * FROM gongwenadmindfggrhb"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 3
Recordset1.LockType = 3
Recordset1.Open()
Recordset1.addnew
Recordset1("公文接收部门")=jieshoubumen
Recordset1("公文报送人帐号")=Session("userssdfgfhtrh")
Recordset1("公文报送人姓名")=Session("names")
Recordset1("公文报送人部门")=Session("bumen")
Recordset1("标题")=gongwenbiaoti
Recordset1("报送日期年份")=year(now())
Recordset1("报送日期月份")=month(now())
Recordset1("报送日期日")=day(now())
Recordset1("报送日期")=date()
if session("huizhi")="是" then
Recordset1("是否回执")="是"
else
Recordset1("是否回执")="否"
end if
Recordset1.update
Recordset1_numRows = 0
%>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
<%
getmaxgongwenid.Close()
Set getmaxgongwenid = Nothing
%>
<%
session("times")=FormatNumber((StartTime-EndTime)*1000,0,-1,0,0)/1000
%>
<% response.redirect "upmaxiddanchungw.asp"%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -