image.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <!--<base href="/multiimg-example/"> your base path -->
  6. <title></title>
  7. <script src="../../../../jquery/jquery-2.1.1.min.js"></script>
  8. <script src="../../../../jQueryFileUpload/vendor/jquery.ui.widget.js"></script>
  9. <script src="../../../../jQueryFileUpload/jquery.fileupload.js"></script>
  10. <style>
  11. body,div{
  12. margin:0;
  13. padding:0;
  14. }
  15. .panel-body{
  16. padding:5px;
  17. }
  18. .upFileBtn {
  19. cursor: pointer;
  20. width: 40px;
  21. height: 40px;
  22. background: url("../btn.jpg") no-repeat;
  23. background-size: 100%;
  24. }
  25. #fileupload_input_color{
  26. display: none;
  27. }
  28. .form-group{
  29. padding:5px;
  30. }
  31. .control-label{
  32. text-align:right;
  33. padding: 10px;
  34. font-weight: bold;
  35. line-height:2;
  36. }
  37. .col-label{
  38. width:15%;
  39. float:left;
  40. }
  41. .col-div{
  42. width:80%;
  43. padding:5px;
  44. overflow:hidden;
  45. }
  46. .thumbnail{
  47. display: inline-block;
  48. position: relative;
  49. width: 20%;
  50. margin:5px;
  51. }
  52. </style>
  53. </head>
  54. <body>
  55. <div class="panel-body">
  56. <form enctype="multipart/form-data" id="form-color" class="form-horizontal" action="javascript:AddGallery();" method="post" action="" autocomplete="off" >
  57. <div class="form-group">
  58. <label class="col-label control-label">上传图片</label>
  59. <div class="col-div">
  60. <input type="file" name="files" multiple id="fileupload_input_color" />
  61. <input class="upFileBtn" type="button" onclick="document.getElementById('fileupload_input_color').click()" />
  62. <br />
  63. </div>
  64. </div>
  65. <div class="form-group">
  66. <label class="col-label control-label">图片列表</label>
  67. <div class="col-sm-6">
  68. <table>
  69. <tr id="Tr3">
  70. <td class="text-left">
  71. <span id="button-color-field"></span>
  72. </td>
  73. </tr>
  74. </table>
  75. </div>
  76. </div>
  77. </form>
  78. </div>
  79. <script>
  80. $("#fileupload_input_color").fileupload({
  81. url: "image_upload.php", //文件上传地址,当然也可以直接写在input的data-url属性内
  82. async: false,
  83. add: function (e, data) {
  84. data.submit();
  85. },
  86. done: function (e, data) {
  87. data = JSON.parse(data.result);
  88. if (data.result == "200") {
  89. parent.top.imgs.push(data.imgurl);
  90. $("#button-color-field").append("<span class='thumbnail'><img width='100%' alt='' src='../../../../" + data.imgurl + "'><input name='product_color_img_ipnut' type='hidden' value='" + data.imgurl + "' /></span>");
  91. } else {
  92. alert(data.msg);
  93. }
  94. }
  95. });
  96. </script>
  97. </body>
  98. </html>