From kodeboard, 4 Years ago, written in PHP.
Embed
  1. if(file_exists($file)) {
  2.     header('Content-Description: File Transfer');
  3.     header('Content-Type: application/octet-stream');
  4.     header('Content-Disposition: attachment; filename='.basename($file));
  5.     header('Content-Transfer-Encoding: binary');
  6.     header('Expires: 0');
  7.     header('Cache-Control: must-revalidate');
  8.     header('Pragma: public');
  9.     header('Content-Length: ' . filesize($file));
  10.     ob_clean();
  11.     flush();
  12.     readfile($file);
  13.     exit;    
  14. }
  15.  
  16.  

You must login to reply or comment on this code.