title: PHP: $zip->addFile issues
body: <p>I have written a simple script to add files to an archive. After much head scratching I can't get the script to work.</p>
  
  <p>I have a php file here which reads from a check-box, the file/s selected in the check-box are added to the array $file.</p>
  
  <pre><code>$path = ('a path');
  $dir = scandir('another path');
  
      if(isset($_POST["submit"])){
      if(!isset($_POST["File"])){
          echo 'A file must be selected to archive it';
          } else { 
              require_once('zip_function.php');
              $file = $_POST['File'];
              $goZipper = goZipper($file, $path);
              if($goZipper == false) {
                  echo ("Error");
              } else { 
                  echo ("Success");
              }
          }   
      }
  </code></pre>
  
  <p>The function goZipper is called and $file and the destination are passed to it, the function is below.</p>
  
  <pre><code>function goZipper($files, $destination = '',$overwrite = true) {
      if(file_exists($destination) &amp;&amp; !$overwrite) {
          echo"File exists";
          return false; 
          }
      if(count($files)){
          $zip = new ZipArchive();
              if($zip-&gt;open($destination,$overwrite ? ZIPARCHIVE::OVERWRITE : ZIPARCHIVE::CREATE) !== true){
                  echo"Error opening destination";
                  return false;
              } 
              foreach($files as $file){
                  $zip-&gt;addFile($file,basename($file));
  
                      echo("&lt;pre&gt;");
                      var_dump($zip);
                      exit();
  
              }
              $zip-&gt;close();
              return file_exists($destination);
              }
              else{
                  return false;
              }
      }
  </code></pre>
  
  <p>The function is returning true every time it is called. But no files are being added. Can anyone spot an obvious error here?</p>