利用化境上传组件上传图片(一)上传页面

代码如下:
  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
  2. <!-- #include file="inc/conn.asp" -->
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml">
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <title>班级相册</title>
  8. <script type="text/javascript" src="./KindEditor.js"></script>
  9. <script type="text/javascript" src="common/common.js"></script>
  10. <link href="css/layout.css" rel="stylesheet" type="text/css" />
  11. <script type="text/javascript">
  12. function CheckForm(){
  13.    if (checkNull(document.getElementById("description"),"图片描述") &
  14.     checkNull(document.getElementById("file"),"上传图片")){
  15.     return true;
  16.     }else{
  17.     return false;
  18.     }
  19. }
  20. </script>
  21. </head>
  22. <%
  23. if Session("uid")="" then response.Redirect("login.asp")
  24. response.Write("<div id=welcome>欢迎你:")
  25. response.Write(Session("userName"))
  26. response.Write("</div>")
  27. id=trim(request("id"))
  28. if id<>"" then
  29.    sql="delete from album where id="
  30.    conn.execute(sql)
  31.    %>
  32.         <script>
  33.      alert("已经成功删除图片");
  34.      location.replace('album.asp');
  35.             </script>
  36.         <%
  37. end if
  38. %>
  39. <body>
  40. <iframe src="navigation.asp" width="100%" height="50" scrolling="no" frameborder="0"></iframe>
  41. <div id="div_bg">
  42. <div id="top"></div>
  43. <div id="middle">
  44. <div id="album_top">
  45. <form method="post" action="upfile.asp" enctype="multipart/form-data" onsubmit="return CheckForm();">
  46.    图片描述:<input name="description" id="description" type="text" class="form_text">
  47. <BR>
  48.    上传照片:<input id="file" name="file" type="file" class="form_text" style="width:400" value="">
  49. <input name="go" type="submit" class="form_btn" value="确定上传">
  50. </form>
  51.     </div>
  52. <div id="album_pic">
  53. <%
  54. set rs=server.CreateObject("adodb.recordset")
  55. sql="select a.id,a.description,a.fileName,a.uid,a.createTime,b.name,b.uid from album as a,member as b where a.uid=b.uid order by a.createtime desc"
  56. rs.open sql,conn,1,3
  57. if rs.eof then 
  58.    response.Write("没有相片")
  59.    response.End()
  60. end if 
  61. rs.pagesize=30
  62. if rs.eof then
  63.    rs_total=0
  64. else
  65.    rsrs_total=rs.recordcount
  66. end if
  67. page=trim(request("page"))
  68. mypage=trim(request("mypage"))
  69. if mypage<>"" then page=clng(mypage)
  70. if page="" then
  71.    page=1
  72. else
  73.    page=clng(page)
  74.    if page<1 then page=1
  75.    if page>rs.pagecount then page=rs.pagecount
  76. end if
  77. %>
  78. <table width="100%" border="0" cellpadding="4" cellspacing="1" bgcolor="#FFFFFF">
  79. <tr>
  80. <%
  81. if not rs.eof then
  82.    rs.absolutepage=page
  83.    repeate_rows=0
  84. while repeate_rows<rs.pagesize and not rs.eof
  85. %>
  86.     <td width="20%">
  87.       <table width="100%" border="0" cellspacing="1">
  88.         <tr>
  89.           <td bgcolor="#FFFFFF">
  90.             <a href="attached/<%=rs("fileName")%>" target="_blank">
  91.               <img src="attached/<%=rs("fileName")%>" width="100" height="100" border="0" title="<%=rs("description")%>">
  92.             </a>
  93.           </td>
  94.         </tr>
  95.         <tr>
  96.           <td height="26" bgcolor="#f7f7f7">
  97.           <%
  98.      if Session("uid")=rs("uid") then
  99.     %>
  100.             <FONT COLOR="#333333"><%=rs("name")%><a href="#" onclick="if (confirm('确定删除')==true) location.replace('?id=<%=id%>')">[删除]</a></FONT>             
  101.             <%
  102.      else
  103.     %>
  104.             <FONT COLOR="#333333"><%=rs("name")%></FONT> 
  105.             <%end if%>           
  106.             <BR>
  107.             <FONT COLOR="#999999"><%=rs("createtime")%></FONT>
  108.           </td>
  109.         </tr>
  110.       </table>
  111.     </td>
  112. <%
  113.    rs.movenext
  114.    repeate_rowsrepeate_rows=repeate_rows+1
  115.    if repeate_rows mod 5=0 then
  116.     response.Write("</tr><tr>")
  117.    end if
  118.    wend
  119. %>
  120.     <%end if%>
  121. </tr>
  122. </table>
  123. <form action="" method="post">
  124. <table width="90%">
  125.     <tr>
  126.         <td align="right">[<%=page%>/<%=rs.pagecount%>] 每页<%=rs.pagesize%>张 共<%=rs_total%>张图片
  127.             <%if page<>1 then%>
  128.             <a href="?page=1">第一页</a>
  129.             <a href="?page=<%=(page-1)%>">上一页</a>
  130.             <%
  131.      end if
  132.      if page<>rs.pagecount then
  133.     %>
  134.             <a href="?page=<%=(page+1)%>">下一页</a>
  135.             <a href="?page=<%=rs.pagecount%>">最后一页</a>
  136.             <%
  137.      end if
  138.      rs.close()
  139.      set rs=nothing
  140.     %>
  141.             指定页码:<input name="mypage" type="text" value="" size="2" maxlength="2" />
  142.             <input type="submit" value="go" name="goPage" /></td>
  143.         </tr>
  144.     </table>
  145. </form>
  146. </div>
  147. </div><div id="foot"></div>
  148. </div>
  149. <div id="bottom">Copyright © 2008 </div>
  150. </body>
  151. </html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值