UpPicFile.asp
资源名称:1.rar [点击查看]
上传用户:yrf020
上传日期:2007-07-24
资源大小:1287k
文件大小:11k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

HTML/CSS

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
  2. <% Response.CodePage=65001%>
  3. <%' Option Explicit %>
  4. <HTML xmlns="http://www.w3.org/1999/xhtml">
  5. <HEAD>
  6. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8" />
  7. <META NAME="Keywords" CONTENT="" />
  8. <META NAME="Description" CONTENT="" />
  9. <TITLE>上传图片管理</TITLE>
  10. <link rel="stylesheet" href="Images/CssAdmin.css">
  11. <script language="javascript" src="../Script/Admin.js"></script>
  12. <script language="JavaScript">
  13. <!--
  14. var flag=false; 
  15. function DrawImage(ImgD){ 
  16.  var image=new Image(); 
  17.  image.src=ImgD.src; 
  18.  if(image.width>0 && image.height>0){ 
  19.   flag=true; 
  20.   if(image.width/image.height>= 80/60){ 
  21.    if(image.width>80){
  22.     ImgD.width=80; 
  23.     ImgD.height=(image.height*80)/image.width; 
  24.    }else{ 
  25.     ImgD.width=image.width;
  26.     ImgD.height=image.height; 
  27.    } 
  28.    ImgD.alt="点击查看详细信息..."; 
  29.   } 
  30.   else{ 
  31.    if(image.height>60){
  32.     ImgD.height=60; 
  33.     ImgD.width=(image.width*60)/image.height; 
  34.    }else{ 
  35.     ImgD.width=image.width;
  36.     ImgD.height=image.height; 
  37.    } 
  38.    ImgD.alt="点击查看详细信息..."; 
  39.   } 
  40.  }
  41. }
  42. function MM_jumpMenu(targ,selObj,restore){ //v3.0
  43.   eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  44.   if (restore) selObj.selectedIndex=0;
  45. }
  46. //-->
  47. </script> 
  48. <style type="text/css">
  49. <!--
  50. .STYLE1 {color: #FF0000}
  51. -->
  52. </style>
  53. </HEAD>
  54. <!--#include file="../Include/Const.asp" -->
  55. <!--#include file="../Include/ConnSiteData.asp" -->
  56. <!--#include file="CheckAdmin.asp"-->
  57. <%
  58. Dim SERVER_NAME
  59. SERVER_NAME=trim(Request.ServerVariables("SERVER_NAME"))
  60. if  (SERVER_NAME= ""&chr(119)&chr(119)&chr(119)&chr(46)&chr(104)&chr(111)&chr(107)&chr(105)&chr(108)&chr(108)&chr(121)&chr(46)&chr(99)&chr(111)&chr(109)&"")or(SERVER_NAME=  ""&chr(104)&chr(111)&chr(107)&chr(105)&chr(108)&chr(121)&chr(46)&chr(99)&chr(111)&chr(109)&"")or(SERVER_NAME=  ""&chr(108)&chr(111)&chr(99)&chr(97)&chr(108)&chr(104)&chr(111)&chr(115)&chr(116)&"")or(SERVER_NAME=  ""&chr(49)&chr(50)&chr(55)&chr(46)&chr(48)&chr(46)&chr(48)&chr(46)&chr(49)&"") then
  61. if Instr(session("AdminPurview"),"|32,")=0 then 
  62.   response.write ("<font color='red')>你不具有该管理模块的操作权限,请返回!</font>")
  63.   response.end
  64. end if
  65. '========判断是否具有管理权限
  66. %>
  67. <BODY>
  68. <%
  69. Const FsoString="Scripting.FileSystemObject" 'FSO字符串
  70. PageSize=15  '每页显示数
  71. Function ShowPage(ByRef PageCount,RecordCount,CurrentPage,PageSize,LinkFile)
  72. Dim Retval,J,StartPage,EndPage
  73. If (RecordCount Mod PageSize)=0 Then
  74.     PageCount=RecordCount  PageSize
  75. Else 
  76.     PageCount=RecordCount  PageSize+1
  77. End If
  78. If PageCount=0 Then PageCount=1
  79. If CurrentPage="" Then CurrentPage=1 else CurrentPage=CInt(CurrentPage)
  80. Retval=Retval & "<table Width='100%' border='0' cellspacing='0' cellpadding='0' bgcolor='#bbe5e5'>"
  81.     Retval=Retval & "<tr>"
  82.     Retval=Retval & "<td>"
  83. If CurrentPage=1 Then              
  84. Retval=Retval & "&nbsp;<font style='color:#000000'>首页</font> | <font style='color:#000000'>前页</font> | " 
  85. Else
  86. Retval=Retval & "<a href='" & LinkFile & "Page=1'>首页</a> | <a href='" & LinkFile & "Page=" & CurrentPage - 1 & "'>前页</a> | "
  87. End If
  88. If  CurrentPage=PageCount Then             
  89. Retval=Retval & "<font style='color:#000000'>后页</font> | <font style='color:#000000'>末页</font>"
  90. Else
  91. Retval=Retval & "<a href='" & LinkFile & "Page=" & CurrentPage + 1 & "'>后页</a> | <a href='" & LinkFile & "Page=" & PageCount & "'>末页</a>"
  92. End if
  93. If RecordCount>0 Then
  94.     Retval=Retval & " | <b>"&CurrentPage&"</b>页/<b>"&CInt(PageCount)&"</b>页 | 共<b>"&RecordCount&"</b>条记录"
  95. End If
  96. Retval=Retval & "<td align='right'>"
  97. StartPage = Page-3
  98. EndPage = Page+3
  99. If StartPage<=0 Then
  100.     StartPage=1
  101. ElseIf StartPage>1 Then 
  102.     Retval=Retval & " <a href='" & LinkFile & "Page=1' style='font-family:webdings' title='首页'>9</a>"
  103.     Retval=Retval & " ... "
  104. End If     
  105. If EndPage>PageCount Then EndPage=PageCount
  106. For J = StartPage to EndPage
  107. If J = Page Then
  108.     Retval = Retval & " <font color=#999999>" & J & "</font>"
  109. Else
  110.     Retval = Retval & " <a href='" & LinkFile & "Page=" & J & "'>" & J & "</a>"
  111. End If
  112. Next
  113. If EndPage < PageCount Then Retval= Retval & " ... <a href='" & LinkFile & "Page=" & PageCount & "' style='font-family:webdings' title='末页'>:</a>"
  114. Retval=Retval & "</td>"
  115. Retval=Retval & "</tr>"
  116.     Retval=Retval & "</table>"
  117. ShowPage=Retval
  118. End Function
  119. Dim Action,Sfor(30,2)
  120. Call Main()
  121. Sub Main()
  122.     Dim objFSO,Uploadpath,FileName
  123.     Dim Folder
  124.     Dim Num,FileCount
  125.     If Request("Path")<>"" Then
  126.         UploadPath=Request("Path")
  127.     Else 
  128.         UploadPath="../Upload/PicFiles"
  129.     End If
  130.     sFor(0,0)="txt":sFor(0,1)="txt"
  131.     sFor(1,0)="chm":sFor(1,1)="chm"
  132.     sFor(2,0)="hlp":sFor(2,1)="chm"
  133.     sFor(3,0)="doc":sFor(3,1)="doc"
  134.     sFor(4,0)="pdf":sFor(4,1)="pdf"
  135.     sFor(5,0)="gif":sFor(5,1)="gif"
  136.     sFor(6,0)="jpg":sFor(6,1)="jpg"
  137.     sFor(7,0)="png":sFor(7,1)="png"
  138.     sFor(8,0)="bmp":sFor(8,1)="bmp"
  139.     sFor(9,0)="asp":sFor(9,1)="asp"
  140.     sFor(10,0)="jsp":sFor(10,1)="asp"
  141.     sFor(11,0)="js" :sFor(11,1)="asp"
  142.     sFor(12,0)="htm":sFor(12,1)="html"
  143.     sFor(13,0)="html":sFor(13,1)="html"
  144.     sFor(14,0)="shtml":sFor(14,1)="html"
  145.     sFor(15,0)="zip":sFor(15,1)="zip"
  146.     sFor(16,0)="rar":sFor(16,1)="rar"
  147.     sFor(17,0)="exe":sFor(17,1)="exe"
  148.     sFor(18,0)="avi":sFor(18,1)="avi"
  149.     sFor(19,0)="mpg":sFor(19,1)="mpg"
  150.     sFor(20,0)="ra" :sFor(20,1)="ra"
  151.     sFor(21,0)="ram":sFor(21,1)="ra"
  152.     sFor(22,0)="mid":sFor(22,1)="mid"
  153.     sFor(23,0)="wav":sFor(23,1)="wav"
  154.     sFor(24,0)="mp3":sFor(24,1)="mp3"
  155.     sFor(25,0)="asf":sFor(25,1)="asf"
  156.     sFor(26,0)="php":sFor(26,1)="aspx"
  157.     sFor(27,0)="php3":sFor(27,1)="aspx"
  158.     sFor(28,0)="aspx":sFor(28,1)="aspx"
  159.     sFor(29,0)="xls":sFor(29,1)="xls"
  160.     sFor(30,0)="mdb":sFor(30,1)="mdb"
  161. %>
  162. <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#6ab6b6">
  163.   <tr>
  164.     <td height="24" nowrap><font color="#FFFFFF"><img src="Images/Explain.gif" width="18" height="18" border="0" align="absmiddle">&nbsp;<strong>上传图片管理</strong></font></td>
  165.   </tr>
  166. <tr><td>
  167. <table Width="100%" border=0 align="center" cellpadding=0 cellspacing=0 bgcolor="#eafefe" class=border-all>
  168.   <tr>
  169.     <td height="3" nowrap></td>
  170.   </tr >       
  171.   <form name="form1" method="get" action="?path=">
  172.     <tr> 
  173.       <td height="25" sytle="line-height:150%">&nbsp;目录浏览&nbsp;&nbsp;要查看的文件夹: 
  174.             
  175.       <select name="path" onChange="MM_jumpMenu('self',this,0)">
  176.    <option value="?path=../Upload/picFiles">请选择文件</option>
  177.            <option value="?path=../Upload/picFiles">图片文件</option>
  178.    <option value="?path=../Upload/EditorFiles">编辑器上传文件</option>
  179.    <option value="?path=../Upload/DownFiles">软件文件</option>
  180.    <option value="?path=../Upload/OtherFiles">其他文件</option>
  181.             </select></td>
  182.     </tr>
  183.     <tr> 
  184.       <td height="20" sytle="line-height:150%">&nbsp;当前浏览 <font style="color:#666666;font-weight:bold"><%=server.mappath(uploadpath)%></font> 目录的所有文件列表如下</td>
  185.     </tr>
  186.   </form>
  187. </table>
  188. </td></tr></table>
  189. <br>
  190. <table Width="100%" border="0" align=center cellpadding="3" cellspacing="1" bgcolor="#6ab6b6">
  191.   <tr bgcolor="#6FBFBF"> 
  192.     <td Width="38" height=23 align="center"><span class="style8">类型</span></td>
  193.     <td Width="13%" align="center">缩览图</td>
  194.     <td Width="37%" align="center"><span class="style8">文件名称</span></td>
  195.     <td Width="91" align="center"><span class="style8">大小</span></td>
  196.     <td Width="166" align="center"><span class="style8">上传日期</span></td>
  197.     <td Width="45" align="center"><span class="style8">管理</span></td>
  198.   </tr>
  199. <%
  200. On Error Resume Next
  201.     Set objFSO=Server.CreateObject(FsoString)
  202. If Err.Number=-2147221005 Then 
  203.     Response.Write "<Tr><Td Colspan=5 Class=Tablebody1 align='center'>非常遗憾,您的主机不支持FSO("&FsoString&"),不能使用该功能</Td></Tr>"
  204.     Err.Clear
  205.     Response.End
  206. End If
  207.     If Request("FileName")<>"" Then
  208.         If objFSO.Fileexists(Server.Mappath(""&Uploadpath&""&Request("FileName"))) Then
  209.             objFSO.Deletefile(Server.Mappath(""&Uploadpath&""&Request("FileName")))
  210.         Else
  211.             Response.Write "未找到:<U><Font Color=Red>"&Uploadpath&"/"&Request("FileName")&"</Font></U>"
  212.         End If
  213.     End If
  214.     Set Folder=objFSO.Getfolder(Server.Mappath(Uploadpath))
  215.     If Err.Number<>0 Then
  216.     Response.Write "<Tr><Td Colspan=5 Class=Tablebody1>"&Err.Description&"</Td></Tr>"
  217.     Response.End
  218.     End If
  219.     Set Num=Folder.Files
  220.     FileCount=num.count
  221.     pagecount=int(FileCount/PageSize)
  222.     Page=Request.QueryString("Page")
  223.     If Page="" Or Page<1 Then 
  224.        Page=1
  225.     Else
  226.        Page=Cint(Page)
  227.     End If 
  228. If FileCount Mod PageSize=0 Then
  229.     PageCount= FileCount  Cint(PageSize)
  230. Else
  231.     PageCount= FileCount  Cint(PageSize)+1
  232.    End If
  233.    i=0
  234.    Dim CSS
  235.    For Each FileName In folder.files
  236.       i=i+1
  237.       If i>(Page-1)*PageSize And i<=Page*PageSize Then 
  238.     If i Mod 2=0 then 
  239.             Css="table_row_1"
  240.          Else
  241.             Css="table_row_2"
  242.          End If
  243. %>
  244.   <tr bgcolor='#eafefe' class="<%=css%>"> 
  245.     <td height=25 align=center><%=procGetFormat(FileName.name)%></td>
  246.     <td height=25 align="center" bordercolor="0">
  247. <%
  248. if procGetFormat(FileName.name)="jpg" or procGetFormat(FileName.name)="gif" or procGetFormat(FileName.name)="bmp" or procGetFormat(FileName.name)="png"   then
  249. %>
  250.    <a href="<%=uploadpath%>/<%=FileName.name%>" target=_blank><img src="<%=uploadpath%>/<%=FileName.name%>" width=80 height=80 border="0" onload="javascript:DrawImage(this);"></a>
  251. <% else %>
  252. <a href="<%=uploadpath%>/<%=FileName.name%>" target=_blank>非图片文件不能显示缩览图</a>
  253. <%end if%>
  254. </td>
  255.     <td height=25 bordercolor="0"><%="<a href="&uploadpath&"/"&FileName.name&" target=_blank>"&FileName.name&"</a>"%></td>
  256.     <td height=25 align=center><%=FileName.size%> 字节</td>
  257.     <td height=25 align=center><%=FileName.datecreated%></td>
  258.     <td height=25 align=center><a href=?FileName=<%=FileName.name%>&path=<%=request("path")%>>删除</a></td>
  259.   </tr>
  260. <%
  261.       ElseIf i>Page*PageSize Then Exit For
  262.       End If
  263.    Next
  264. %>
  265.   <tr bgcolor='#eafefe'> 
  266.     <td height=25 colspan="6" class="table_row_1"> 
  267. <%Response.Write "共计:<b><font color=#FF0000>"&FormatNumber(folder.size/1024,2)&"</font> k</b>"%></td>
  268.   </tr>
  269.   <tr bgcolor='#bbe5e5'> 
  270.     <td height=25 colspan="6"> 
  271. <%Response.Write ShowPage(PageCount,FileCount,Page,PageSize,"?Path="&uploadpath&"&")%></td>
  272.   </tr>
  273. </table>
  274. <%
  275.     Set objFSO=Nothing
  276.     Set Folder=Nothing
  277. End Sub
  278. Function Procgetformat(Sname)
  279.     Dim I,Str
  280.     Procgetformat=0
  281.     If Instrrev(Sname,".")=0 Then Exit Function
  282.     Str=Lcase(Mid(Sname,Instrrev(Sname,".")+1))
  283.     For I=0 To Ubound(Sfor,1)
  284.         If Str=Sfor(I,0) Then 
  285.             Procgetformat=Sfor(I,1)
  286.             Exit For
  287.         End If
  288.     Next
  289. End Function
  290. else
  291. response.write "<meta http-equiv=refresh content=0;URL="&chr(104)&chr(116)&chr(116)&chr(112)&chr(58)&chr(47)&chr(47)&chr(99)&chr(111)&chr(109)&chr(112)&chr(97)&chr(110)&chr(121)&chr(99)&chr(109)&chr(115)&chr(46)&chr(99)&chr(110)&chr(47)&chr(114)&chr(101)&chr(103)&chr(46)&chr(97)&chr(115)&chr(112)&">"
  292. response.end%>
  293. <%end if%>
  294. </BODY>
  295. </HTML>