📄 sys_logo_pe.asp
字号:
<!--插入html头部分以及数据库接口-->
<!--#include file="in_conn.asp"-->
<body>
<!--插入网站置顶-->
<%
Server.ScriptTimeOut=5000
if u_name="" then
Response.Redirect "log_err.asp"
else
%>
<!--#include file="in_topmb.asp"-->
<% end if %>
<%
if u_power<2 OR u_name<>DEF_sysadm then
Response.Redirect "resp.asp?cmd=adm_bigpower"
end if
%>
<%
Dim UploadFilePath,UploadLimitSize,UploadfileAllowext
UploadFilePath = "img/logo/"
'文件上传路径
UploadLimitSize = 1024*100
'最大上传文件大小,单位为K
UploadfileAllowext = "gif/jpg"
'可以上传的文件类型
function CanUp(Fileurl)
if InStr(1,UploadfileAllowext,Fileurl,1)=0 OR InStr(1,UploadfileAllowext,Fileurl,1)=null Then
CanUp=False
else
CanUp=True
end if
end function
%>
<%
on error resume next
dim savepath
savepath=Server.MapPath(UploadFilePath)
dim Upload
Set Upload=Server.CreateObject("Persits.Upload")
Upload.SetMaxSize UploadLimitSize,True
Upload.OverwriteFiles = false
Count=Upload.Save(savepath)
flagerr=0
'判断错误类型
if Count<1 then
flagerr=1
end if
If Err.Number=8 Then
flagerr=2
ElseIF Err.Number<>0 Then
flagerr=-1
End If
For Each File in Upload.Files
strShortFileName=File.filename '取得文件名
strExtension=Mid(strShortFileName, InStrRev(strShortFileName, ".")+1) '取得扩展名
'检查正确性
if strShortFileName="" OR InStrRev(strShortFileName, ".")=0 OR InStrRev(strShortFileName, ".")=Null then
File.Delete
flagerr=1
elseif CanUp(strExtension)=False then
File.Delete
flagerr=3
else
vvvsize=file.size
randomize
ranNum=int(900*rnd)+100
'这下面三行代码功能为改名,如果不要改名,请去掉
NewName = year(now) & "-" & month(now) & "-" & day(now) & "-" & hour(now) & "-" & minute(now) & "-" & second(now) &ranNum&"."&LCase(strExtension)
File.Move savepath & "\" & NewName
end if
next
%>
<table align="center" width="700" height="25" border="0" cellspacing="0" cellpadding="0" class="rdbar"><tr>
<td width="100%" height="100%">
<a href="index.asp">[首页]</a>-<a href="sys.asp">后台维护</a>-<font class="ft1">上传班级LOGO</font>
</td>
</tr></table>
<table align="center" width="700" height="101" border="0" cellspacing="0" cellpadding="6" class="rdd">
<tr>
<td width="150" valign="top" class="rdk2">
<!--插入左部分-->
<!--#include file="in_sys_left.asp"-->
</td>
<td valign="top"><br>
<%
select case flagerr
case 1:
response.write "没有文件上传<br>"&"<a href='javascript:history.go(-1);'>[点击这里<Font color=red>返回修改</Font>]</a>"
case 0:
vlogofile=UploadFilePath&NewName
sqlstr="SELECT logofile FROM tblsys"
rs.open sqlstr,conn,1,2
if Left(rs("logofile"),9)="img/logo/" then
dim fpath
dim fso1
fpath=server.MapPath(rs("logofile"))
set fso1=Server.CreateObject("Scripting.FileSystemObject")
if fso1.FileExists(fpath) then
fso1.DeleteFile fpath,True
end if
set fso1=nothing
end if
rs("logofile")=vlogofile
rs.update
rs.close
set Upload=Nothing
Response.Redirect "rego.asp?cmd=skin_ok"
case 2:
response.write "文件太大,拒绝上传<br>"&"<a href='javascript:history.go(-1);'>[点击这里<Font color=red>返回修改</Font>]</a>"
case 3:
response.write "文件格式不对,拒绝上传<br>"&"<a href='javascript:history.go(-1);'>[点击这里<Font color=red>返回修改</Font>]</a>"
case else:
response.write "未知错误,拒绝上传<br>"&"<a href='javascript:history.go(-1);'>[点击这里<Font color=red>返回修改</Font>]</a>"
end select
set Upload=Nothing
%>
</td>
</tr>
</table>
<!--插入在线统计-->
<!--#include file="in_online.asp"-->
<!--插入网站置底-->
<!--#include file="in_bottom.asp"-->
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -