📄 upshengaoimg.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 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)>500 then
response.write"<script>alert('"&Session("names")&"很抱歉,您的文件太大,系统允许上传的最大文件是500KB。');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) ''保存文件
'response.write file.FilePath&file.FileName&" ("&cint(file.FileSize/1024)&"K) => "&formPath&File.FileName&" 成功!<br>"
iCount=iCount+1
dim total
total=1
'end sub
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.back();"">返回</a>]</body></html>"
'response.end
end sub
%>
<%
Dim Recordset2
Dim Recordset2_numRows
Set Recordset2 = Server.CreateObject("ADODB.Recordset")
Recordset2.ActiveConnection = MM_oavbsconn_STRING
Recordset2.Source = "select * from 签发审稿图片 "
Recordset2.CursorType = 0
Recordset2.CursorLocation = 3
Recordset2.LockType = 3
Recordset2.Open()
Recordset2.addnew
Recordset2("帐号")=Session("userssdfgfhtrh")
Recordset2("姓名")=Session("names")
Recordset2("部门")=Session("bumen")
Recordset2("审稿图片路径")="../../dataandfiles/files/fawen/shengao/"&newname
session("qianfalujing")="../../dataandfiles/files/fawen/shengao/"&newname
Recordset2.update
Recordset2_numRows = 0
%>
<%
Recordset2.Close()
Set Recordset2 = Nothing
%>
<script>
{
history.go(-1)
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -