title: PHP > Download ZIP : Network Error
body: <p>i have a big problem with my php code, i use a html form for get the 'filename', work perfectly, BUT my problem is : when i launch the download, all browser's download zip files, and get Network error, ex : 578ko / 600ko : Network Error.</p>
  
  <pre><code>&lt;?php
  $dir = "lol/"; // trailing slash is important
  $file = $dir .$_POST['filename'] ;
  
  if (file_exists($file)) {
      header('Pragma: public');
      header("Expires: 0");
      header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
      header("Cache-Control: public");
      header("Content-Transfer-Encoding: binary");
      header("Content-type: application/zip");
      header('Content-Disposition: attachment; filename='.basename($file));
      header('Cache-Control: must-revalidate');
      header('Content-Length: ' . filesize($file));
  
      readfile($file);
  
  } else {
      echo "Le fichier $file n'existe pas.";
  }
  exit;
  ?&gt;
  </code></pre>