writepostcopy2007-6-29.asp
来自「绿叶oa系统办公自动化 2008.工作日志管理,文件管理」· ASP 代码 · 共 200 行
ASP
200 行
<%@ TRANSACTION = Required%>
<%
Response.ExpiresAbsolute=now()-1
Response.CacheControl="no-cache"
%>
<!--#include file="../../Connections/leq.asp" -->
<!--#include file="../../Connections/oavbsconn.asp" -->
<%
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/ifr/ifrasp.asp" -->
<!-- #include file="u/Upload.asp" -->
<%
Server.ScriptTimeout = 9999
set Upload = new DoteyUpload
Upload.MaxTotalBytes = 999999999999999999999999 *1024 *1024 ' 最大10MB
If Request.TotalBytes > 999999999999999999999999 *1024 *1024 Then
Response.Write "<script>alert(""不要上传超过1GB的文件"");</script>"
End If
Upload.ProgressID = Request.QueryString("ProgressID")
dim path
path="../../dataandfiles/files/tz/"
Dim objFSO1
Set objFSO1= Server.CreateObject("Scripting.FileSystemObject")
If objFSO1.FolderExists(Server.MapPath(path)) Then
Else
objFSO1.CreateFolder(Server.MapPath(path))
Set objFSO1 = Nothing
End If
dim path1
path1="../../dataandfiles/files/tz/"&session("bumen")&"/"
Dim objFSO11
Set objFSO11= Server.CreateObject("Scripting.FileSystemObject")
If objFSO11.FolderExists(Server.MapPath(path1)) Then
Else
objFSO11.CreateFolder(Server.MapPath(path1))
Set objFSO11 = Nothing
End If%>
<%Upload.SaveTo(path1)
ok="是"
if Upload.ErrMsg <> "" then
Response.Write(Upload.ErrMsg)
Response.End()
end if
bt=upload.Form("标题")
o=upload.Form("开关")
if o<>"" then o="否"
if o="" then o="是"
c=upload.Form("content")
for each File in Upload.Files.Items
%>
<%next%>
<% Set UploadRequest = CreateObject("Scripting.Dictionary")
dim upload,file,formName,formPath,iCount
if chongmingfou="1" then
if fset="1" then
fn=File.FileName&o
end if
end if
if chongmingfou="1" then
if fset="2" then
path1=path1&date()&"-"&hour(now())&"-"&minute(now())&"-"&second(now())&"_"&rndnum
end if
end if
%>
<%
for each File in Upload.Files.Items
dim f
f=File.FileSize/1024
IF f<1024 then
f1=ROUND((f),2)&"KB"
end if
IF f>=1024 then
f1=ROUND((f)/1000,2)&"MB"
END IF
if isempty(bt) or trim(bt)="" then
ok="否"
end if
if isempty(c) or trim(c)="" then
ok="否"
end if
fdaxiao=round(File.FileSize/1024,2)&"KB"
if instr(File.FileName,"'")>0 then response.write"<script>alert('"&Session("names")&"很抱歉,您上传的."&File.FileName&"含有'等非法字符。');location='"&request.ServerVariables("HTTP_REFERER")&"'</script>"
'fn=replace(File.FileName,"'","")
else
fn=File.FileName
end if
set Command1 = Server.CreateObject("ADODB.Command")
Command1.ActiveConnection = MM_oavbsconn_STRING
Command1.CommandText = "insert into 通知附件db (文件名,文件路径,文件大小,发送人帐号,发送人姓名,发送人部门,ok) values ('"& File.FileName&"','"& path1&File.FileName &"','"& f1 &"','"& Session("userssdfgfhtrh") &"','"& Session("names") &"','"& Session("bumen") &"','"& ok &"')"
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()
%>
<%next%>
<%
if isempty(bt) or trim(bt)="" then
%>
<!--#include file="u/delthebtorcotnewrongfiles.asp" -->
<script>
alert("请输入通知标题或标题不能为空格。");history.go(-1)
</script>
<%'response.end()
end if%>
<% if isempty(c) or trim(c)="" then%>
<iframe src="u/delthebtorcotnewrongfiles.asp" height="0" width="0"></iframe>
<script>
alert("请输入通知内容或内容不能为空格。");history.go(-1)
</script>
<%response.end()
end if%>
<%
Dim maxid__MMColParam
maxid__MMColParam = "1"
If (Session("userssdfgfhtrh") <> "") Then
maxid__MMColParam = Session("userssdfgfhtrh")
End If
%>
<%
Dim maxid
Dim maxid_numRows
Set maxid = Server.CreateObject("ADODB.Recordset")
maxid.ActiveConnection = MM_oavbsconn_STRING
maxid.Source = "SELECT max(ID)+1 as maxid FROM 通知附件db WHERE 发送人帐号 = '" + Replace(maxid__MMColParam, "'", "''") + "'"
maxid.CursorType = 0
maxid.CursorLocation = 2
maxid.LockType = 1
maxid.Open()
maxid_numRows = 0
%>
<%IF not maxid.eof or not maxid.bof then
dim ids
ids=maxid("maxid")
end if%>
<%
Dim Recordset2
Dim Recordset2_numRows
dim jieshourenuser
Set Recordset2 = Server.CreateObject("ADODB.Recordset")
Recordset2.ActiveConnection = MM_oavbsconn_STRING
Recordset2.Source = "SELECT * FROM infoall"
Recordset2.CursorType = 0
Recordset2.CursorLocation = 3
Recordset2.LockType = 3
Recordset2.Open()
Recordset2.addnew
Recordset2("标题")=bt
Recordset2("内容")=c
Recordset2("发送人部门")=Session("bumen")
Recordset2("发送人姓名")=Session("names")
Recordset2("发送人帐号")=Session("userssdfgfhtrh")
Recordset2("入库日期")=upload.form("datas")
Recordset2("信息属性")="通知"
Recordset2("有无附件")=session("youwufujian")
Recordset2("开关")=o
Recordset2.update
Recordset2_numRows = 0
%>
<%
Recordset2.Close()
Set Recordset2 = Nothing
%><%
maxid.Close()
Set maxid = Nothing
%>
<iframe src="u/ifrupdateid.asp" width="0" height="0"></iframe>
<script language="javascript">
{
alert("通知发布成功!");location.href="admintzlistdfghwerth.asp"}
</script>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?