title: Download xlsx file using php
body: <p>I need make <code>xlsx</code> file download from my site (but not from directly open file url like this: <code>http://site.com/file.xlsx</code> ) </p>
  
  <p>So, this is php code</p>
  
  <pre><code>        $file = "somefile.xlsx";
          header('Content-Description: File Transfer');
          header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
          header('Content-Disposition: attachment; filename='.basename($file));
          header('Content-Transfer-Encoding: binary');
          header('Expires: 0');
          header('Cache-Control: must-revalidate');
          header('Pragma: public');
          header('Content-Length: ' . filesize($file));
          ob_clean();
          flush();
          readfile($file);
  </code></pre>
  
  <p>file is downloaded, his extension is <code>.xlsx</code>, but when trying open this file in ms excel, file not opened and I got error : <code>excel cannot open the file.xlsx because the file format or file extension is not valid</code></p>
  
  <p>Tell please, why this happened? where I am wrong?</p>