title: Starting a MP4 download from a php script
body: <p>So I have this small PHP condition for a PHP download, it's been working fine for weeks then all of a sudden I noticed it's stopped working.</p>
  
  <p>Rather than getting a download of the file, the users are getting a 0kb file instead.</p>
  
  <p>I have checked the URL and it's still working as expected.</p>
  
  <p>Here is the code</p>
  
  <pre><code>if ($refer == 'stackoverflow.com' || $refer == 'dev.stackoverflow.com') {
  
          $fichero = $downloadUrl;
  
          if ($fichero) {
                  header('Content-Description: File Transfer');
                  header('Content-Type: application/octet-stream');
                  header('Content-Disposition: attachment; filename='.basename($fichero));
                  header('Content-Transfer-Encoding: binary');
                  header('Expires: 0');
                  header('Cache-Control: must-revalidate');
                  header('Pragma: public');
                  header('Content-Length: ' . filesize($fichero));
                  ob_clean();
                  flush();
                  readfile($fichero);
                  exit;
          } else {
                  die("The File $fichero does not exist");
          }
  } else {
          die("Sorry you must start the download from the website");
  }
  </code></pre>
  
  <p>Now I know it's hitting the conditionals, because I am not getting any of the die statements and the file is still being offered as a download. This seems to have broken in Chrome and also IE(Edge). I have been doing some reading regarding headers and the only documentation on this proble I can find that appears to be relevant is the expires setting which i set to 0.</p>
  
  <p>Am I missing an easy trick here?</p>
  
  <p>Thanks a lot!</p>