title: Download of .zip file runs a corrupted file php
body: <p>I'm trying to force a download of a protected zip file  (I don't want people to access it without logging in first.</p>
  
  <p>I have the function created for the <code>login</code> and such  , but I'm running into a problem where the downloaded file is corrupting.</p>
  
  <p>Here's the code I have:</p>
  
  <pre><code>$file='../downloads/'.$filename;
  header("Content-type: application/zip;\n");
  header("Content-Transfer-Encoding: Binary");
  header("Content-length: ".filesize($file).";\n");
  header("Content-disposition: attachment; filename=\"".basename($file)."\"");
  readfile("$file");
  exit();
  </code></pre>
  
  <p>Here's the error: <code>Cannot open file: It does not appear to be a valid archive.</code></p>
  
  <p>The file downloads fine otherwise, so it must be something  I'm doing wrong with the headers.</p>
  
  <p>Any ideas?</p>