title: ZIP file download php readfile() error
body: <p>I know this question is posted in this forum for many times, but trust me I have tried all the possible solutions suggested but it didn't work for me.</p>
  
  <p>I am trying to download multiple files using zip, though the zip file gets downloaded successfully, its corrupt and I encounter error after opening it in notepad:</p>
  
  <blockquote>
    <p>Warning:  readfile(E:\Downloads/IMG-20140831-WA0000.zip) [function.readfile]: failed to open stream: No such file or directory in...</p>
  </blockquote>
  
  <p>I tried all the possible solutions mentioned in the forum such as header-check, web server user has write permission to the folder where I am creating the ZIP file, error-checking before downloading etc. but it did't worked out.</p>
  
  <p>After performing error checking, I encountered something like </p>
  
  <blockquote>
    <p>Error creating ZIP file : IMG-20140831-WA0000.zip</p>
  </blockquote>
  
  <p>My code snippet:</p>
  
  <pre><code>function zipFilesDownload($file_names, $archive_file_name, $file_path) {
      $zip = new ZipArchive;
      if ($zip-&gt;open($archive_file_name, ZipArchive::CREATE) !== TRUE) {
          exit("cannot open &lt;$archive_file_name&gt;\n");
      }
      foreach($file_names as $files) {
          $zip-&gt;addFile($file_path . $files, $files);
      }
      if ($zip-&gt;close() === false) {
          exit("Error creating ZIP file : " . $archive_file_name);
      }
      if (file_exists($archive_file_name)) {
          header("Content-Description: File Transfer");
          header("Content-type: application/zip"); 
          header("Content-Disposition: attachment; filename=" . $archive_file_name . "");
          header("Pragma: no-cache");
          header("Expires: 0");
          readfile("E:\Downloads/" . $archive_file_name);
          ob_clean();
          flush();
          exit;
      } else {
          exit("Could not find Zip file to download");
      }
  }
  $fileNames = array(
      'D:\\xampp\htdocs\BE\Multimedia/' . $fullName,
      'D:\\xampp\htdocs\BE\Decrypt/' . $decrypt_file
  );
  $zip_file_name = $actualName . '.zip';
  $file_path = dirname("E:\Downloads") . '/';
  zipFilesDownload($fileNames, $zip_file_name, $file_path);
  </code></pre>
  
  <p>Please suggest some solutions.</p>