📄 upimgpost.asp
字号:
<%Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.cachecontrol = "no-cache"%>
<%
' *** 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/oavbsconn.asp" -->
<!--#include file="../bbs/upload_5xsoft.inc"-->
<%
Server.ScriptTimeout=900
dim upload,file,formName,formPath,iCount
set upload=new upload_5xSoft ''建立上传对象
%>
<%if upload.form("filepath")="" then%>
<script language="javascript">
{
alert("请选择图片!");history.go(-1)
}
</script>
<%response.end()
end if%>
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Session("userssdfgfhtrh") <> "") Then
Recordset1__MMColParam = Session("userssdfgfhtrh")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_oavbsconn_STRING
Recordset1.Source = "SELECT * FROM usertertggbng WHERE usersdsfg56 = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
%>
<% if not Recordset1.eof or not Recordset1.bof then
olgimgpath=Recordset1("fawenforimg")
end if
dim num1
dim rndnum
Randomize
Do While Len(rndnum)<50
num1=CStr(Chr((57-48)*rnd+48))
rndnum=rndnum&num1
loop
function MakedownName()
dim fname
fname = now()
fname = replace(fname,"-","")
fname = replace(fname," ","")
fname = replace(fname,":","")
fname = replace(fname,"PM","")
fname = replace(fname,"AM","")
fname = replace(fname,"上午","")
fname = replace(fname,"下午","")
fname=fname& rndnum
'fname=Session("userssdfgfhtrh")&fname
MakedownName=fname
end function
if upload.form("filepath")="" then ''得到上传目录
HtmEnd "请输入要上传至的目录!"
set upload=nothing
response.end
else
formPath=upload.form("filepath")
''在目录后加(/)
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))
if fileformat<>"" then
if fileformat=".jpg" or fileformat=".jpeg" or fileformat=".gif" or fileformat=".png" or fileformat=".bmp" then
else
response.write"<script>alert('图片类型需为jpg,gif,png,bmp格式!');history.go(-1)</script>"
response.end
end if
end if
if cint(file.FileSize/1024)>5000 then
response.write"<script>alert('"&Session("names")&"很抱歉,您的文件太大,系统允许上传的最大文件是5000KB。');location='"&request.ServerVariables("HTTP_REFERER")&"'</script>"
response.end
end if
dim flength,fpath,fname
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
newname=MakedownName()&"."&mid(file.FileName,InStrRev(file.FileName, ".")+1)
'flength=file.FileSize
flength=cint(file.FileSize/1024)
fpath=formPath&File.FileName
fname=file.FileName
session("fnames")=fname
newname=MakedownName()&"."&mid(file.FileName,InStrRev(file.FileName, ".")+1)
file.SaveAs Server.mappath(formPath&newname) ''保存文件
iCount=iCount+1
dim total
total=1
end if
if newname<>"" then
Recordset1("fawenforimg")="../../dataandfiles/files/dianziqianming/"&newname
end if
Recordset1.update
set file=nothing
next
set upload=nothing ''删除此对象
'Htmend iCount&" 个文件上传结束!"
sub HtmEnd(Msg)
set upload=nothing
response.write "<br>"&Msg&" [<a href=""javascript:history.back();"">返回</a>]</body></html>"
'response.end
end sub
%>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
<%
if("../../dataandfiles/files/dianziqianming/"&newname <> "") then Command1__p1 = "../../dataandfiles/files/dianziqianming/"&newname
if(Session("userssdfgfhtrh") <> "") then Command1__u = Session("userssdfgfhtrh")
%>
<%
if("../../dataandfiles/files/dianziqianming/"&newname <> "") then Command2__p2 = "../../dataandfiles/files/dianziqianming/"&newname
if(Session("userssdfgfhtrh") <> "") then Command2__u = Session("userssdfgfhtrh")
%>
<%
if(Session("userssdfgfhtrh") <> "") then Command3__u = Session("userssdfgfhtrh")
if("../../dataandfiles/files/dianziqianming/"&newname <> "") then Command3__p = "../../dataandfiles/files/dianziqianming/"&newname
%>
<%
if("../../dataandfiles/files/dianziqianming/"&newname <> "") then Command4__p = "../../dataandfiles/files/dianziqianming/"&newname
if(session("names") <> "") then Command4__n = session("names")
%>
<%
set Command1 = Server.CreateObject("ADODB.Command")
Command1.ActiveConnection = MM_oavbsconn_STRING
Command1.CommandText = "UPDATE fawen SET 导入签发图片='" + Replace(Command1__p1, "'", "''") + "' WHERE 签名帐号='" + Replace(Command1__u, "'", "''") + "' "
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()
%>
<%
set Command2 = Server.CreateObject("ADODB.Command")
Command2.ActiveConnection = MM_oavbsconn_STRING
Command2.CommandText = "UPDATE fawen SET 导入审稿图片='" + Replace(Command2__p2, "'", "''") + "' WHERE 审核帐号='" + Replace(Command2__u, "'", "''") + "' "
Command2.CommandType = 1
Command2.CommandTimeout = 0
Command2.Prepared = true
Command2.Execute()
%>
<%
set Command3 = Server.CreateObject("ADODB.Command")
Command3.ActiveConnection = MM_oavbsconn_STRING
Command3.CommandText = "UPDATE shouwenyijian SET 电子签名='" + Replace(Command3__p, "'", "''") + "' WHERE 审批人帐号='" + Replace(Command3__u, "'", "''") + "' "
Command3.CommandType = 1
Command3.CommandTimeout = 0
Command3.Prepared = true
Command3.Execute()
%>
<%
set Command4 = Server.CreateObject("ADODB.Command")
Command4.ActiveConnection = MM_oavbsconn_STRING
Command4.CommandText = "UPDATE fawenshenimg SET 审稿图片路径='" + Replace(Command4__p, "'", "''") + "' WHERE 姓名='" + Replace(Command4__n, "'", "''") + "' "
Command4.CommandType = 1
Command4.CommandTimeout = 0
Command4.Prepared = true
Command4.Execute()
%>
<% Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
if olgimgpath<>"" then
If objFSO.FileExists(Server.MapPath(olgimgpath)) Then
objFSO.DeleteFile Server.MapPath(olgimgpath),True
end if
end if%>
<%response.redirect ("updatimgpath.asp")%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -