PHP Download File Forcefully

In php there are some situation where you want to download file Forcefully.For that you have to use php header function. In header function you have to use Content-Type as application/octet-stream and Content-Disposition.


  ob_clean();
  ob_start();
  $filename='private_movie.zip';
  $absoluteFilePath='/public_html/downloads/private_movie.zip'
  header("Pragma: public");     
  header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  header("Cache-Control: maxage=1"); 
  header ("Content-Type: application/octet-stream");
  header ("Content-Length: " . filesize($absoluteFilePath));
  header ("Content-Disposition: attachment; filename=$filename");
  readfile($absoluteFilePath);