?? upfileintodatalogcopy.asp
字號:
<%Response.Expires = -1
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="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%>
<%
Dim selectasp
Dim selectasp_numRows
Set selectasp = Server.CreateObject("ADODB.Recordset")
selectasp.ActiveConnection = MM_oavbsconn_STRING
selectasp.Source = "SELECT 限制文件類型 FROM 限制文件類型 WHERE 限制文件類型 ='.asp' "
selectasp.CursorType = 0
selectasp.CursorLocation = 3
selectasp.LockType = 3
selectasp.Open()
selectasp_numRows = 0
%>
<% if selectasp.eof and selectasp.bof then %>
<%
selectasp.addnew
selectasp("限制文件類型")=".asp"
selectasp.update
end if
%>
<%
Dim JSP
Dim JSP_numRows
Set JSP = Server.CreateObject("ADODB.Recordset")
JSP.ActiveConnection = MM_oavbsconn_STRING
JSP.Source = "SELECT 限制文件類型 FROM 限制文件類型 WHERE 限制文件類型 ='.jsp'"
JSP.CursorType = 0
JSP.CursorLocation = 3
JSP.LockType = 3
JSP.Open()
JSP_numRows = 0
%>
<% if jsp.eof and jsp.bof then %>
<%
jsp.addnew
jsp("限制文件類型")=".jsp"
jsp.update
end if
%>
<%
Dim php
Dim php_numRows
Set php = Server.CreateObject("ADODB.Recordset")
php.ActiveConnection = MM_oavbsconn_STRING
php.Source = "SELECT 限制文件類型 FROM 限制文件類型 WHERE 限制文件類型 ='.php'"
php.CursorType = 0
php.CursorLocation = 3
php.LockType = 3
php.Open()
php_numRows = 0
%>
<% if php.eof and php.bof then %>
<%
php.addnew
php("限制文件類型")=".php"
php.update
end if
%>
<%
Dim exe
Dim exe_numRows
Set exe = Server.CreateObject("ADODB.Recordset")
exe.ActiveConnection = MM_oavbsconn_STRING
exe.Source = "SELECT 限制文件類型 FROM 限制文件類型 WHERE 限制文件類型 ='.exe'"
exe.CursorType = 0
exe.CursorLocation = 3
exe.LockType = 3
exe.Open()
exe_numRows = 0
%>
<% if exe.eof and exe.bof then %>
<%
exe.addnew
exe("限制文件類型")=".exe"
exe.update
end if
%>
<%
Dim asa
Dim asa_numRows
Set asa = Server.CreateObject("ADODB.Recordset")
asa.ActiveConnection = MM_oavbsconn_STRING
asa.Source = "SELECT 限制文件類型 FROM 限制文件類型 WHERE 限制文件類型 ='.asa'"
asa.CursorType = 0
asa.CursorLocation = 3
asa.LockType = 3
asa.Open()
asa_numRows = 0
%>
<% if asa.eof and asa.bof then %>
<%
asa.addnew
asa("限制文件類型")=".asa"
asa.update
end if
%>
<%
Dim aspx
Dim aspx_numRows
Set aspx = Server.CreateObject("ADODB.Recordset")
aspx.ActiveConnection = MM_oavbsconn_STRING
aspx.Source = "SELECT 限制文件類型 FROM 限制文件類型 WHERE 限制文件類型 ='.aspx'"
aspx.CursorType = 0
aspx.CursorLocation = 3
aspx.LockType = 3
aspx.Open()
aspx_numRows = 0
%>
<% if aspx.eof and aspx.bof then %>
<%
aspx.addnew
aspx("限制文件類型")=".aspx"
aspx.update
end if
%>
<%
Dim com
Dim com_numRows
Set com = Server.CreateObject("ADODB.Recordset")
com.ActiveConnection = MM_oavbsconn_STRING
com.Source = "SELECT 限制文件類型 FROM 限制文件類型 WHERE 限制文件類型 ='.com'"
com.CursorType = 0
com.CursorLocation = 3
com.LockType = 3
com.Open()
com_numRows = 0
%>
<% if com.eof and com.bof then %>
<%
com.addnew
com("限制文件類型")=".com"
com.update
end if
%>
<%
Dim bat
Dim bat_numRows
Set bat = Server.CreateObject("ADODB.Recordset")
bat.ActiveConnection = MM_oavbsconn_STRING
bat.Source = "SELECT 限制文件類型 FROM 限制文件類型 WHERE 限制文件類型 ='.bat'"
bat.CursorType = 0
bat.CursorLocation = 3
bat.LockType = 3
bat.Open()
bat_numRows = 0
%>
<% if bat.eof and bat.bof then %>
<%
bat.addnew
bat("限制文件類型")=".bat"
bat.update
end if
%>
<%
Dim dll
Dim dll_numRows
Set dll = Server.CreateObject("ADODB.Recordset")
dll.ActiveConnection = MM_oavbsconn_STRING
dll.Source = "SELECT * FROM 限制文件類型 WHERE 限制文件類型 ='.dll'"
dll.CursorType = 0
dll.CursorLocation = 3
dll.LockType = 3
dll.Open()
dll_numRows = 0
%>
<% if dll.eof and dll.bof then %>
<%
dll.addnew
dll("限制文件類型")=".dll"
dll.update
end if
%>
<%
dll.Close()
Set dll = Nothing
%>
<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">文件上传..
<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 '釋放 FileSystemObject 對象實例內存空間
end if
%>
<%
if upload.form("City")<>"對所有人群發" then
formPath=Recordset1("getrealpath")
p1=Recordset1("pathaccess") '用于list.asp
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=lcase(right(file.filename,4))
fileformat111=lcase(right(file.filename,5))
Dim ftype__MMColParam
ftype__MMColParam = "1"
If (fileformat <> "") Then
End If
Dim ftype
Dim ftype_numRows
Set ftype = Server.CreateObject("ADODB.Recordset")
ftype.ActiveConnection = MM_oavbsconn_STRING
ftype.Source = "SELECT 限制文件類型 FROM 限制文件類型 WHERE 限制文件類型 = '" + Replace(ftype__MMColParam, "'", "''") + "'"
ftype.CursorType = 0
ftype.CursorLocation = 2
ftype.LockType = 1
ftype.Open()
ftype_numRows = 0
if not ftype.eof or not ftype.bof then
ftype.Close()
set ftype = Nothing
response.write"<script>alert('"&Session("names")&"很抱歉,您上傳的"&fileformat&"文件類型,系統安全機制不允許,建議更改文件后綴。');location='"&request.ServerVariables("HTTP_REFERER")&"'</script>"
response.end
end if
Dim ftype111__MMColParam
ftype111__MMColParam = "1"
If (fileformat111 <> "") Then
ftype111__MMColParam = fileformat111
End If
Dim ftype111
Dim ftype111_numRows
Set ftype111 = Server.CreateObject("ADODB.Recordset")
ftype111.ActiveConnection = MM_oavbsconn_STRING
ftype111.Source = "SELECT 限制文件類型 FROM 限制文件類型 WHERE 限制文件類型 = '" + Replace(ftype111__MMColParam, "'", "''") + "'"
ftype111.CursorType = 0
ftype111.CursorLocation = 2
ftype111.LockType = 1
ftype111.Open()
ftype111_numRows = 0
if not ftype111.eof or not ftype111.bof then
ftype111.Close()
set ftype111 = Nothing
response.write"<script>alert('"&Session("names")&"很抱歉,您上傳的."&fileformat&"文件類型,系統安全機制不允許,建議更改文件后綴。');location='"&request.ServerVariables("HTTP_REFERER")&"'</script>"
response.end
end if
Dim filebig
Dim filebig_numRows
Set filebig = Server.CreateObject("ADODB.Recordset")
filebig.ActiveConnection = MM_oavbsconn_STRING
filebig.Source = "SELECT * FROM 文件限制大小"
filebig.CursorType = 0
filebig.CursorLocation = 2
filebig.LockType = 1
filebig.Open()
filebig_numRows = 0
if cint(file.FileSize/1024)>filebig("文件限制大小") then
response.write"<script>alert('"&Session("names")&"很抱歉,您的文件太大,系統允許上傳的最大文件是"&filebig("文件限制大小")&"KB。請聯系管理員!');location='"&request.ServerVariables("HTTP_REFERER")&"'</script>"
filebig.Close()
set filebig = Nothing
response.end
end if
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 ''刪除此對象
Htmend iCount&" 個文件發送成功!"
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
%>
<%
JSP.Close()
Set JSP = Nothing
%>
<%
php.Close()
Set php = Nothing
%>
<%
asa.Close()
set asa = Nothing
%>
<%
com.Close()
set com = Nothing
%>
<%
bat.Close()
set bat = Nothing
%>
<%
aspx.Close()
set aspx = Nothing
%>
<%
selectasp.Close()
Set selectasp = Nothing
%>
<%
exe.Close()
set exe = Nothing
%>
<%ftype.Close()
set ftype = Nothing%>
<%ftype111.Close()
set ftype111 = 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 + -