title: PHP: send WORD document file to download
body: <p>This question is trivial and has many answers, all the same or nearly but for my case, it doesn't solve as expected?
  Goal: send WORD file as attachment with PHP (simple...)
  Mean: here is the code:</p>
  
  <pre><code>// send the file to the browser
  header("Cache-Control: no-store");
  header("Content-Type: application/octet-stream");
  //header("Content-type: application/msword");
  header('Content-Disposition: attachment; filename="'. basename($filename) . '"');
  header('Content-Transfer-Encoding: binary');
  header('Content-Length: '. filesize($filename));
  ob_clean();
  flush();
  readfile($filename);
  exit();
  </code></pre>
  
  <p>Well, everything seems right but the file I saved on my computer cannot be read by MS-WORD: it reads some special chars like: </p>
  
  <blockquote>
    <p>PK          ! /Œt1«   á      [Content_Types].xml ...</p>
  </blockquote>
  
  <p>But if I open the original from the server, everything is ok.
  I missed something obvious...
  Any advice is welcome because I tried nearly ALL the methods I read...but still the same result.</p>