title: when upload zip folder validate that only .jpg,.png files will save inside zip folder +php
body: <pre><code>&lt;?php
  
      $fileName = $_FILES["uploaded_file"]["name"]; 
      $fileTmpLoc = $_FILES["uploaded_file"]["tmp_name"];
      $fileType = $_FILES["uploaded_file"]["type"]; 
      $fileSize = $_FILES["uploaded_file"]["size"]; 
      $fileErrorMsg = $_FILES["uploaded_file"]["error"]; 
      $fileName = preg_replace('#[^a-z.0-9]#i', '', $fileName); 
      $kaboom = explode(".", $fileName); 
      $fileExt = end($kaboom);
  
      $foldername= $_SESSION['user_name'];
      $fileName = $_SESSION['user_name']."_".session_id().".".$fileExt;
  
      $path= "upload"/" $foldername";
  
      if (!$fileTmpLoc) 
  { 
          echo "&lt;script type='text/javascript'&gt;alert('ERROR: Please browse for a file before clicking the upload button.')&lt;/script&gt;";
          exit();
      } 
  
      else if (!preg_match("/.(rar|zip|tar)$/i", $fileName) ) 
  {
           echo "&lt;script type='text/javascript'&gt;alert('ERROR: Your Folder was not .rar, .zip, or .tar .')&lt;/script&gt;";
           unlink($fileTmpLoc);
           exit();
      } 
      else if ($fileErrorMsg == 1) 
  {   
          echo "&lt;script type='text/javascript'&gt;alert('ERROR: An error occured while processing the file. Try again.')&lt;/script&gt;";
          exit();
      }
  
      else if(!preg_match("/.(jpg|png|jpeg)$/i",$path))
  {
          echo "&lt;script type='text/javascript'&gt;alert('ERROR: Your Files inside zip was not .jpg, .png, or .jpeg .')&lt;/script&gt;";
          exit();
      }
  
  
      $moveResult = move_uploaded_file($fileTmpLoc, "upload/$foldername/$fileName");
  
      if ($moveResult != true) {
          echo "&lt;script type='text/javascript'&gt;alert('ERROR: File not uploaded. Try again.')&lt;/script&gt;";
          exit();
      }
  
      echo "&lt;script type='text/javascript'&gt;alert('The file named $fileName uploaded successfuly. It is $fileSize bytes in size.')&lt;/script&gt;";
  
      }
  ?&gt;
  </code></pre>