writepost07-6-4ok.asp

来自「绿叶oa系统办公自动化 2008.工作日志管理,文件管理」· ASP 代码 · 共 241 行

ASP
241
字号
<%  
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="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%>
<%  
  dim fp
'fp=path1&File.FileName
'fp=File.FileName
Dim testfname__MMColParam
testfname__MMColParam = "1"
If (fp <> "") Then 
  testfname__MMColParam = fp
End If
%>
<%
Dim testfname
Dim testfname_numRows
Set testfname = Server.CreateObject("ADODB.Recordset")
testfname.ActiveConnection = MM_oavbsconn_STRING
testfname.Source = "SELECT ID  FROM 通知附件db  WHERE 文件路径 = '" + Replace(testfname__MMColParam, "'", "''") + "'"
testfname.CursorType = 0
testfname.CursorLocation = 2
testfname.LockType = 1
testfname.Open()
testfname_numRows = 0
%>

<%if not testfname.eof or not testfname.bof then
if fset="3" then
response.redirect("../gw/wrong.asp")
end if
response.end()
end if
%>
<%if fset="1" then
dim num1
dim rndnum
Randomize
Do While Len(rndnum)<5
num1=CStr(Chr((6-4)*rnd+4))
rndnum=rndnum&num1
loop
o1=o&date()&"-"&hour(now())&"-"&minute(now())&"-"&second(now())&"_"&rndnum&"OA自动更名"

response.write o1
response.end()
'path1=path1&o1
end if
 Upload.SaveTo(path1)
  if Upload.ErrMsg <> "" then 
    Response.Write(Upload.ErrMsg)
    Response.End()
  end if
  if Upload.Files.Count > 0 then
	Items = Upload.Files.Items
  end if
  for each File in Upload.Files.Items
	%>
<%
  Response.Write("您已上传 " & Upload.Files.Count & " 个文件到: " & path & "<hr>")
%>
<%
 Response.Write("文件名: " & File.FileName & "<br>")
  Response.Write("文件大小: " & File.FileSize/1024 & " KB<br>")
   Response.Write("文件类型: " & File.FileType & "<br>")
  Response.Write("客户端路径: " & File.FilePath & "<br>")
  Response.Write("<hr>")
 Response.Write("<br>")
   response.write file.FilePath  & " (" & file.FileType & "/" & file.FileSize/1024 &"K) => <a target=_blank href='" & path1 & File.NewFileName & "'>" & formPath & File.FileName & "</a> 成功!<br>"
  response.write "<br /><BR>"
 
%><%next%>


<% Set UploadRequest = CreateObject("Scripting.Dictionary")
    dim upload,file,formName,formPath,iCount
  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
  
   fdaxiao=round(File.FileSize/1024,2)&"KB"
set Command1 = Server.CreateObject("ADODB.Command")
Command1.ActiveConnection = MM_oavbsconn_STRING
Command1.CommandText = "insert into 通知附件db (文件名,文件路径,文件大小,发送人帐号,发送人姓名,发送人部门) values ('"& File.FileName &"','"& path1&File.FileName &"','"& f1 &"','"& Session("userssdfgfhtrh") &"','"& Session("names") &"','"& Session("bumen") &"')"
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()
next
%>


<%dim bt,c,bumen,o,fset
c=upload.Form("content")
bt=upload.Form("标题")
o=upload.Form("开关")
fset=upload.Form("f")
%>
<%if o="" then 
o="是"
end if%>
<%
if bt="" then 
	  Response.Write("<script>alert(""请输入标题!"");location=""javascript:history.back()"";</script>")  
	  Response.End
  end if
%>
<%
if  len(bt)<2 then 
	  Response.Write("<script>alert(""通知标题需要2个以上字符!"");location=""javascript:history.back()"";</script>")  
	  Response.End
  end if
%>
<%
if c="" then 
	  Response.Write("<script>alert(""请输入通知内容!"");location=""javascript:history.back()"";</script>")  
	  Response.End
  end if
%>
<%
if  len(c)>65535 then 
	  Response.Write("<script>alert(""您输入的内容超出数据库极限,系统最多接收的字符是65535个!"");location=""javascript:history.back()"";</script>")  
	  Response.End
  end if
%>
<!--#include file="../../Connections/ifr/ifrasp.asp" -->
<%
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 + -
显示快捷键?