title: ZipArchive not opening file - Error Code: 19
body: <p>Im having issues with my code being able to open a zip file that i have uploaded and moved into a folder, the zip file uploads fine and you can open it in any Zip program however, when i attempt to open it with ZipArchive to extract the data it errors.</p>
  
  <pre><code>    $path = "../"; // Upload directory      
      $count = 0;
  
      foreach ($_FILES['files']['name'] as $f =&gt; $name) {     
         if(move_uploaded_file($_FILES["files"]["tmp_name"][$f], $path . $name))
               $count++; // Number of successfully uploaded file
      }
  
      $kioskFile = $_FILES['files']['name'][0];
      $kioskFile = explode(".", $kioskFile);
      $kioskFile = $kioskFile[0];
      $zipFile = "../" . $kioskFile . ".zip";     
  
      $zip = new ZipArchive;
      $res = $zip-&gt;open($zipFile);
      if ($res === true) {
          $zip-&gt;extractTo("./");
          $zip-&gt;close();
      } else {
          echo "Error Cannot Open Zip File - Error Code: ";
      }
  </code></pre>
  
  <p>When i run the code it shows me a Error Code 19</p>
  
  <p>ZIPARCHIVE::ER_NOZIP - 19</p>
  
  <p>This is the error im getting, however the file exists and if i use zip_open, it returns that it can open the zip file.</p>
  
  <p>Any help would be very greatful </p>
  
  <p><strong>EDIT1</strong> 
  If i upload a zip file that i manually create (using a zip program) then the upload works fine. However if i use a ZipArchive created zip file, then it instantly errors with a error 19.</p>
  
  <p><strong>EDIT2</strong> 
  I have now added a check to make sure the file exists in the right directory and also put a print of the location also, both match, however still the same issue. Error 19</p>
  
  <pre><code>    $path = "../"; // Upload directory      
      $count = 0;
  
      foreach ($_FILES['files']['name'] as $f =&gt; $name) {     
         if(move_uploaded_file($_FILES["files"]["tmp_name"][$f], $path . $name))
               $count++; // Number of successfully uploaded file
      }
  
      $kioskFile = $_FILES['files']['name'][0];
      $kioskFile = explode(".", $kioskFile);
      $kioskFile = $kioskFile[0];
      $realpath = realpath("../");
      $zipFile = $realpath . "\\" .  $kioskFile . ".zip";     
  
      if (file_exists($zipFile)) {
          $extract = zip_extract($zipFile, "../");
          if ($extract === TRUE) {
  
          } else {
              echo "The file " . $zipFile . " cannot be opened";  
          }
      } else {
          echo "The file " . $zipFile . " does not exist";
          die();
      }
  </code></pre>
  
  <p><strong>UPDATE1</strong>
  So i think ive narrowed it down to either this bit of code, or the download script that i use to download the .zip file from the system, if i leave the zip on the system and use the exact same bit of code it works fine.</p>
  
  <p>Here is my download code, maybe ive missed something on this that is causing the issue.</p>
  
  <pre><code>    $fileID = $_GET['id'];
      $backupLoc = "backups/";
      $sql = "SELECT * FROM backups WHERE id = '" . addslashes($fileID) .  "' LIMIT 1";
      $res = mysql_query($sql);
      $row = mysql_fetch_array($res); 
      $backupFile = $row['backupFile'];
      $zipFile = $backupLoc . "/" . $backupFile . ".zip";
      $zipSize = filesize($zipFile);
  
      header('Content-type: application/zip');
      header('Content-Disposition: attachment; filename="' . basename($zipFile). '"'); 
      ob_end_flush();
      readfile($zipFile);
      exit;
      die();
  </code></pre>