📄 uppic.asp
字号:
<!--#include file ="Web.asp"-->
<%T_Web "上传图片管理",7
Sub Main
On Error Resume Next
types=CheckStr(Trim(Request("types")))
If types="" Then types="uploadpic"
If CheckStr(Trim(Request("ntype")))="del" Then
Set fso = Server.CreateObject("scripting.filesystemobject")
file2=server.mappath("../images/"&types&"/"&CheckStr(Trim(Request("id"))))
If fso.fileexists(file2) Then
fso.Deletefile file2
End If
Set fso = Nothing
End If
Set fs=createobject("scripting.filesystemobject")
picpath=server.mappath("../images/"&types&"/")
Set f=fs.getfolder(picpath)
Set fc=f.files
dim show()
maxperpage=12
redim preserve show(0)
i=1
For Each f1 In fc
redim preserve show(i)
show(i)=f1.name
i=i+1
Next
Set fc=Nothing
Set f=Nothing
Set fs=Nothing
page=CheckStr(Trim(Request("page")))
maxpage=int(UBound(show)/maxperpage)
If UBound(show)-maxpage*maxperpage>0 Then maxpage=maxpage+1
If page="" Then
page=1
Else
page=cint(page)
End If
If page<1 Then page=1
If page>maxpage Then page=maxpage
pagebegin=(page-1)*maxperpage+1
pagecount=0
If types="pic" Then
Response.Write("<a href=""uppic.asp""><img src=""images/p_type0_0.gif"" border=""0""></a>")&vbCrLf
Response.Write("<a href=""uppic.asp?types=pic""><img src=""images/p_type1_1.gif"" border=""0""></a>")&vbCrLf
Else
Response.Write("<a href=""uppic.asp""><img src=""images/p_type0_1.gif"" border=""0""></a>")&vbCrLf
Response.Write("<a href=""uppic.asp?types=pic""><img src=""images/p_type1_0.gif"" border=""0""></a>")&vbCrLf
End If
Response.Write("<form method=""post"">")&vbCrLf
Response.Write"<table width='90%' border='0' cellpadding='1' cellspacing='1' bgcolor='#c0c0c0'>"
j=0
For i=pagebegin To UBound(show)
pagecount=pagecount+1
If pagecount>maxperpage Then Exit For
If show(i)<>"thumbs.db" Then
j=j+1
Response.Write"<tr onmouseover=""this.style.backgroundcolor='#ffffdd'"" onmouseout=""this.style.backgroundcolor='#ffffff'"" bgcolor=""#ffffff"">"
Response.Write"<td align=""center"" width=""40"" height=""30"">"
Response.Write"<img src=""../images/"&types&"/"&show(i)&""" align=""absmiddle"" width=""30"" height=""20"" title=""<img src='../images/"&types&"/"&show(i)&"' align='absmiddle'>""></td>"
Response.Write"<td>"
Response.Write"<a href=""../images/"&types&"/"&show(i)&""" target=""_blank"" title=""<img src='../images/"&types&"/"&show(i)&"' align='absmiddle'>"">"&show(i)&"</a></td>"
Response.Write"<td align=""center"" width=""60"">"
Response.Write"[<span style=""cursor:hand"" onclick=""if(confirm('您确定要删除该图片吗?此操作不可恢复!')){location.href='?ntype=del&types="&types&"&id="&show(i)&"'}"">删除</span>]</td>"
Response.Write"</tr>"
End If
Next
Response.Write"</table>"
Response.Write("<br>第")&vbCrLf
For i=1 To maxpage
If page=i Then
Response.Write i
Else
Response.Write"<a href=uppic.asp?page="&i&"&types="&types&" ><u>["&i&"]</u></a> "
End If
Next
Response.Write("页")
End Sub%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -