juniorsabbath

Untitled

Jul 24th, 2017
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.40 KB | None | 0 0
  1. <?php
  2.     if (isset($_FILES['imagen'])){
  3.        
  4.         $cantidad= count($_FILES["imagen"]["tmp_name"]);
  5.        
  6.         for ($i=0; $i<$cantidad; $i++){
  7.         //Comprobamos si el fichero es una imagen
  8.         if ($_FILES['imagen']['type'][$i]=='image/png' || $_FILES['imagen']['type'][$i]=='image/jpeg'){
  9.             //Subimos el fichero al servidor
  10.             move_uploaded_file($_FILES["imagen"]["tmp_name"][$i], $_FILES["imagen"]["name"][$i]);
  11.             $validar=true;
  12.             }
  13.             else $validar=false;
  14.         }
  15.     }
  16. ?>
  17.  
  18. <!DOCTYPE html>
  19. <html lang="en">
  20. <head>
  21.     <meta charset="utf-8">
  22.     <!-- This file has been downloaded from Bootsnipp.com. Enjoy! -->
  23.     <title>Portfolio Gallery with filtering category - Bootsnipp.com</title>
  24.     <meta name="viewport" content="width=device-width, initial-scale=1">
  25.     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
  26.     <style type="text/css">
  27.        
  28. .gallery-title
  29. {
  30.     font-size: 36px;
  31.     color: #42B32F;
  32.     text-align: center;
  33.     font-weight: 500;
  34.     margin-bottom: 70px;
  35. }
  36. .gallery-title:after {
  37.     content: "";
  38.     position: absolute;
  39.     width: 7.5%;
  40.     left: 46.5%;
  41.     height: 45px;
  42.     border-bottom: 1px solid #5e5e5e;
  43. }
  44. .filter-button
  45. {
  46.     font-size: 18px;
  47.     border: 1px solid #42B32F;
  48.     border-radius: 5px;
  49.     text-align: center;
  50.     color: #42B32F;
  51.     margin-bottom: 30px;
  52.  
  53. }
  54. .filter-button:hover
  55. {
  56.     font-size: 18px;
  57.     border: 1px solid #42B32F;
  58.     border-radius: 5px;
  59.     text-align: center;
  60.     color: #ffffff;
  61.     background-color: #42B32F;
  62.  
  63. }
  64. .btn-default:active .filter-button:active
  65. {
  66.     background-color: #42B32F;
  67.     color: white;
  68. }
  69.  
  70. .port-image
  71. {
  72.     width: 100%;
  73. }
  74.  
  75. .gallery_product
  76. {
  77.     margin-bottom: 30px;
  78. }
  79.  
  80.     </style>
  81.     <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
  82.     <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
  83. </head>
  84. <body>
  85.  <div class="container">
  86.         <div class="row">
  87.         <div class="gallery col-lg-12 col-md-12 col-sm-12 col-xs-12" style="margin-top: 40px">
  88.             <h1 class="gallery-title">Subir Multiples Imagenes</h1>
  89.         </div>
  90.         </div>
  91.  
  92.         <div class="row">
  93.         <div align="center">
  94.             <form method="post" action="?" enctype="multipart/form-data">
  95.             <input type="file"  class="btn btn-default" name="imagen[]" value="" multiple><br>
  96.             <input type="submit" class="btn btn-primary" value="Subir Imagen">
  97.             </form>
  98.         </div>
  99.         <div style="height: 100px">
  100.            
  101.         </div>
  102.         <div class="row">
  103.  
  104.             <?php
  105.                 if (isset($_FILES['imagen']) && $validar==true){
  106.             ?>
  107.             <?php
  108.                 $cantidad= count($_FILES["imagen"]["tmp_name"]);   
  109.                 for ($i=0; $i<$cantidad; $i++){
  110.             ?>
  111.  
  112.  
  113.            
  114.               <div class="col-sm-3">
  115.                 <div class="card">
  116.                   <div class="card-block">
  117.                     <h3 class="card-title">Imagen</h3>
  118.                     <img src="<?php echo $_FILES["imagen"]["name"][$i] ?>" class="img-responsive" width="100%">
  119.                     <p class="card-text" style="word-wrap: break-word;"><?php echo $_FILES["imagen"]["name"][$i] ?></p>
  120.                     <a href="#" class="btn btn-primary">Detalles</a>
  121.                   </div>
  122.                 </div>
  123.               </div>
  124.            
  125.             <?php
  126.                     }
  127.                 }
  128.             ?>
  129.             </div>
  130.             <!--div class="gallery_product col-lg-4 col-md-4 col-sm-4 col-xs-6 filter hdpe">
  131.                 <img src="http://fakeimg.pl/365x365/" class="img-responsive">
  132.             </div-->
  133.  
  134.            
  135.         </div>
  136.     </div>
  137. </section>
  138.  
  139. <script type="text/javascript">
  140. $(document).ready(function(){
  141.  
  142.     $(".filter-button").click(function(){
  143.         var value = $(this).attr('data-filter');
  144.        
  145.         if(value == "all")
  146.         {
  147.             //$('.filter').removeClass('hidden');
  148.             $('.filter').show('1000');
  149.         }
  150.         else
  151.         {
  152. //            $('.filter[filter-item="'+value+'"]').removeClass('hidden');
  153. //            $(".filter").not('.filter[filter-item="'+value+'"]').addClass('hidden');
  154.             $(".filter").not('.'+value).hide('3000');
  155.             $('.filter').filter('.'+value).show('3000');
  156.            
  157.         }
  158.     });
  159.    
  160.     if ($(".filter-button").removeClass("active")) {
  161. $(this).removeClass("active");
  162. }
  163. $(this).addClass("active");
  164.  
  165. });
  166. </script>
  167. </body>
  168. </html>
Advertisement
Add Comment
Please, Sign In to add comment