title: download zip files in php using headers
body: <p>I have following PHP Script for downloading the zip files:</p>
  
  <pre><code>header("Content-length:".filesize($archive_file_name));
  header('Content-Type: application/zip'); // ZIP file
  header('Content-Disposition: attachment; filename="downloadpackage.zip"');
  header('Content-Transfer-Encoding: binary');
  readfile($archive_file_name);
  exit();
  </code></pre>
  
  <p>But it doesn't force the download the zip file instead, it shows the lots of unusual characters like below:</p>
  
  <p>PK[�FA����#�X$D:\voice_06101243342pm014771957.wav�|�s]�y���b�CI\��{2m��M'�Eibu2\@B��܋{� 6b# $H,\@��:��Z�(q�����ә���Y��q�����,� ���� d��y��O�tp$PĽg��w}��}�r֯[7�u�"w���|o�7/Z��ˋ^Z������Ң�ZTZ\S|N����c�X8��c�X8��c�X8��c�X8��c�X8���۲,��a�oA*=ە���do:��|ˉ'rb�|�L2�*^�:q׵}/��\�s�Z?��G�[��=ϗ?</p>
  
  <p>I have also placed the below code before the headers function :</p>
  
  <pre><code>if (headers_sent()) 
  {
    // HTTP header has already been sent
    return false;
  }
  // clean buffer(s)
  while (ob_get_level() &gt; 0)
  {
     ob_end_clean();
  }
  </code></pre>
  
  <p>This ignore to display those character and zip is also not force to download. I couldn't figure out the problem, please help me, it will be greatly appreciated.</p>