title: php creating zips without path to files inside the zip
body: <p>I'm trying to use php to create a zip file (which it does - taken from this page - <a href="http://davidwalsh.name/create-zip-php" rel="noreferrer">http://davidwalsh.name/create-zip-php</a>), however inside the zip file are all of the folder names to the file itself. </p>
  
  <p>Is it possible to just have the file inside the zip minus all the folders?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>function create_zip($files = array(), $destination = '', $overwrite = true) {
  
      if(file_exists($destination) &amp;&amp; !$overwrite) { return false; };
      $valid_files = array();
      if(is_array($files)) {
          foreach($files as $file) { 
              if(file_exists($file)) { 
                  $valid_files[] = $file;
              };
          };
      };
      if(count($valid_files)) { 
          $zip = new ZipArchive();
          if($zip-&gt;open($destination,$overwrite ? ZIPARCHIVE::OVERWRITE : ZIPARCHIVE::CREATE) !== true) { 
              return false;
          };
          foreach($valid_files as $file) { 
              $zip-&gt;addFile($file,$file);
          };
          $zip-&gt;close();
          return file_exists($destination);
      } else {
          return false;
      };
  
  };
  
  
  $files_to_zip = array('/media/138/file_01.jpg','/media/138/file_01.jpg','/media/138/file_01.jpg');
  
  $result = create_zip($files_to_zip,'/...full_site_path.../downloads/138/138_files.zip');
  </code></pre>