PageRenderTime 25ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/members_only/photo_gallery/images/filmstrip.asp

http://github.com/evizitei/bcfpd_asp
ASP | 114 lines | 95 code | 19 blank | 0 comment | 6 complexity | a6be65942de61aa43ea037d5f6c99fd8 MD5 | raw file
  1. <!-- #include virtual="/members_only/include/functions.asa"-->
  2. <%
  3. Dim mySmartUpload
  4. Dim File1, File2, File3, File4
  5. Category_ID = Request.QueryString("Category_ID")
  6. set rsImgCat = Server.CreateObject("ADODB.Recordset")
  7. set rsImage = Server.CreateObject("ADODB.Recordset")
  8. strSQL = "SELECT Name FROM Image_Category WHERE Category_ID = " & Category_ID
  9. rsImgCat.Open strSQL, cnnMain, 0, 1
  10. ImageCatName = rsImgCat("Name")
  11. rsImgCat.Close
  12. ImgPath = "c:\websites\bcfdmo\images\photo_gallery\images\filmstrip\"
  13. ImgVirtualPath = "/images/photo_gallery/images/filmstrip/"
  14. Set fs = CreateObject("Scripting.FileSystemObject")
  15. Set f = fs.GetFolder(ImgPath & "\")
  16. Set fc = f.Files
  17. If Not fs.FolderExists(ImgPath) Then
  18. fs.CreateFolder ImgPath
  19. End If
  20. if Request.ServerVariables("REQUEST_METHOD") = "POST" then
  21. Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
  22. mySmartUpload.Upload
  23. intCount = mySmartUpload.Save(server.mappath(ImgVirtualPath))
  24. for Counter = 1 to intCount
  25. strSQL = "INSERT INTO Image (Image_Category_ID, ThumbnailName, FilmStrip) VALUES (" & Category_ID & ", '" & mySmartUpload.Files.item(Counter).filename & "',1)"
  26. cnnMain.execute(strSQL)
  27. next
  28. for each item in mySmartUpload.Form("Delete")
  29. rsImage.Open "SELECT ThumbnailName FROM Image WHERE Image_ID = " & item, cnnMain,3,3
  30. if not rsImage.EOF then
  31. fs.DeleteFile(ImgPath & rsImage("ThumbnailName"))
  32. rsImage.Delete
  33. end if
  34. rsImage.Close
  35. next
  36. end if
  37. strSQL = "SELECT * FROM Image WHERE FilmStrip = 1 and Image_Category_ID = " & Category_ID
  38. rsImage.Open strSQL, cnnMain, 0, 1
  39. %>
  40. <!--#include virtual="/members_only/include/templates/top.asa"-->
  41. <!--#include virtual="/members_only/include/templates/members.asa"-->
  42. <table border="0" cellspacing="0" cellpadding="5">
  43. <tr>
  44. <td class="PageTitle">Photo Gallery Images -- <%=ImageCatName%></td>
  45. </tr>
  46. <tr>
  47. <td>
  48. <form method="POST" id=form1 name=form1 action="<%=Request.ServerVariables("SCRIPT_NAME")%>?Category_ID=<%=Category_ID%>" ENCTYPE="multipart/form-data">
  49. <table border="0" cellpadding="0" cellspacing="0">
  50. <tr>
  51. <td></td>
  52. <td>
  53. <table border="1" cellpadding="5" cellspacing="0" bordercolor="#f2f2f2">
  54. <tr>
  55. <td class="subheadercenter">Delete</td>
  56. <td class="subheadercenter">Image</td>
  57. </tr>
  58. <% FilmStripCount = 0
  59. do while not rsImage.EOF %>
  60. <tr>
  61. <td align="center"><INPUT type="checkbox" id=checkbox1 name="Delete" value="<%=rsImage("Image_ID")%>"></td>
  62. <td ><IMG src="<%=ImgVirtualPath & rsImage("ThumbnailName")%>" width=100></td>
  63. </tr>
  64. <% rsImage.MoveNext
  65. FilmStripCount = FilmStripCount + 1
  66. loop
  67. rsImage.Close %>
  68. <%
  69. Do while FilmStripCount < 4
  70. FilmStripCount = FilmStripCount + 1 %>
  71. <tr>
  72. <td>&nbsp</td>
  73. <td class="ContactInfo" bordercolor="#f2f2f2">Filmstrip Image <%=FilmStripCount%>:</td>
  74. <td><input type="file" id="FilmStrip<%=FilmStripCount%>" name="FilmStrip<%=FilmStripCount%>"></td>
  75. </tr>
  76. <% loop %>
  77. <tr>
  78. <td align="right" colspan="3">
  79. <a href="javascript:submit(document.form1, 'Add Images');"><img SRC="/images/members/buttons/add.gif" border="0" width="45" height="34"></a>
  80. <img src="/images/spacer.gif" border="0" height="1" width="35">
  81. <a href="javascript:submit(document.form1, 'Delete');"><img SRC="/images/members/buttons/Delete.gif" border="0" width="45" height="34"></a>
  82. <img src="/images/spacer.gif" border="0" height="1" width="35">
  83. <a style="cursor: hand" OnClick="window.location='/members_only/photo_gallery/images/index.asp';"><img src="/images/members/buttons/cancel.gif" border="0" width="45" height="34"></a>
  84. <input type="hidden" name="Submit">
  85. </td>
  86. </tr>
  87. </table>
  88. </td>
  89. </tr>
  90. </table>
  91. </form>
  92. </td>
  93. </tr>
  94. </table>
  95. <!--#include virtual="/members_only/include/templates/bottom.asa"-->