⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 upfileintodatalog.asp

📁 绿叶oa系统v6.04试用版(2007-4-29) 带视频演示
💻 ASP
字号:
<%Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.cachecontrol = "no-cache"%>
<%
Dim StartTime,EndTime
StartTime=timer()
%>
<%server.ScriptTimeout=1800%>
<%
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="upload_5xsoft.inc"-->
<!--#include file="../../../Connections/gongyobngwenjianxitongvbs.asp" -->
<!--#include file="../../../Connections/oavbsconn.asp" -->
<!--#include file="../../../Connections/ifr/ifrasp.asp" -->
<%if session("loginstatus")<>"islogined" then
response.Redirect("../../../index.asp")
end if%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../../../css/link.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style2 {font-size: 12}
-->
</style>
</head>
<body>
<img src="../../../toall/jfoanet/img/978.gif" width="27" height="24">&#25991;&#20214;&#19978;&#20256;..
<hr size=1  color="#5AAE18" noshadow width=700 align=left>
<p><br>
  <br>
  <%
Server.ScriptTimeout=900
dim upload,file,formName,formPath,iCount,fileformat
set upload=new upload_5xSoft ''建立上传对象
%>
<% if upload.form("bumen")="请选择部门" then %>
<script language="javascript">
{
alert("请选择部门");history.go(-1)
}
</script>
<%response.end
end if%>

<% if upload.form("City")="" then %>
<script language="javascript">
{
alert("请选择接收人");history.go(-1)
}
</script>
<%response.end
end if%>
<%
if upload.form("filepath111")="" then   ''得到上传目录
HtmEnd "请输入要上传至的目录!"
 set upload=nothing
 response.end
else
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (upload.form("City") <> "") Then 
  Recordset1__MMColParam = upload.form("City")
End If
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_oavbsconn_STRING
Recordset1.Source = "SELECT names,部门,getrealpath,pathaccess  FROM usertertggbng  WHERE names = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
if upload.form("City")="对所有人群发" then 
p1="../../../dataandfiles/files/qunfafiles"
formPath=p1
jieshounames="对所有人群发"
jieshoubumen="对所有人群发"

  Dim objFSO
  Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If not objFSO.FolderExists(Server.MapPath(p1)) Then
objFSO.CreateFolder(Server.MapPath(p1))   
   End If
  Set objFSO = Nothing
end if
%>
<%
if upload.form("City")<>"对所有人群发" then 
formPath=Recordset1("getrealpath")
p1=Recordset1("pathaccess")
jieshounames=Recordset1("names")
jieshoubumen=Recordset1("部门")
  Dim objFSO1
  Set objFSO1= Server.CreateObject("Scripting.FileSystemObject")
  If  objFSO1.FolderExists(Server.MapPath(formPath))   Then   
Else   
objFSO1.CreateFolder(Server.MapPath(formPath))
Set objFSO1 = Nothing      '释放 FileSystemObject 对象实例内存空间
End   If   
end if
%>
<%
dim huizhi,fuyan
huizhi=upload.form("huizhi")
fuyan=upload.form("fuyan")
if huizhi="是" then
else
huizhi="否"
end if
%>
<%
if  len(fuyan)>65535then 
	  Response.Write("<script>alert(""您输入的附言内容超出数据库极限,系统最多接收的字符是65535个!"");location=""javascript:history.back()"";</script>")  
	  Response.End
  end if
%>
<%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="../../../toall/gw/ftyepseesrfgtsf.asp"-->
<%
dim flength,fpath,fname
 if file.FileSize>0 then 
flength=cint(file.FileSize/1024)
fpath=p1&"/"&File.FileName
if flength=0 then
flength=1
end if
session("userpath")=fpath
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("City") <> "") Then 
  datalog__vargeter = upload.form("City")
End If
Dim datalogdel
datalogdel = "是"
If (upload.form("MM_EmptyValue") <> "") Then 
  datalogdel= upload.form("MM_EmptyValue")
End If
Dim datalog
Dim datalog_numRows
Set datalog = Server.CreateObject("ADODB.Recordset")
datalog.ActiveConnection = MM_gongyobngwenjianxitongvbs_STRING
datalog.Source = "SELECT 文件名,文件路径,上传人帐号,接收人姓名,上传人姓名,上传人部门,接收人帐号,接收人部门,文件大小,是否回执,附言 FROM 文件信息  WHERE 文件名= '" + Replace(datalog__MMColParam, "'", "''") + "' and 接收人姓名='" + Replace(datalog__vargeter, "'", "''") + "' and 接收人是否删除='否'"
datalog.CursorType = 0
datalog.CursorLocation = 3
datalog.LockType = 3
datalog.Open()
if not datalog.eof then 
response.Redirect("wrong.asp")
response.end()
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)  发送成功!<br>"
  iCount=iCount+1
  dim total
total=1
dim ks
ks="k"
do while total<=iCount and datalog.eof 
datalog.addnew
total=total+1
datalog("文件名")= fname
datalog("文件路径")=fpath
datalog("上传人帐号")=Session("userssdfgfhtrh")
datalog("接收人姓名")=jieshounames
datalog("上传人姓名")=Session("names")
datalog("上传人部门")=Session("bumen")
datalog("接收人帐号")=upload.form("City")
datalog("接收人部门")=jieshoubumen
datalog("接收人部门")=jieshoubumen
datalog("文件大小")=flength&"KB"
datalog("文件大小")=flength&"KB"
datalog("是否回执")=huizhi
datalog("附言")=fuyan
datalog.update
Recordset1_numRows = 0
loop
 end if
set file=nothing
next
set upload=nothing
if icount<>0 then
Htmend iCount&" 个文件上传结束!"
else
response.write " 0个文件上传结束,空文件不予以存储!"
end if
sub HtmEnd(Msg)
 set upload=nothing
 response.write "<br>"&Msg&" <a href=""javascript:history.go(-1);"">返回</a></body></html>"
end sub
%>
 <a href="totongshifiles.asp">查看发送记录</a>
</span></p>
</body>
</html>
<%on error resume next
datalog.Close()
Set datalog = Nothing
%>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
<%
EndTime=timer()     
Response.Write "<p align=""left"">通讯时间:" & FormatNumber((EndTime-StartTime)*1000,0,-1,0,0)/1000 & " 秒"
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -