×

Welcome to TagMyCode

Please login or create account to add a snippet.
2
0
 
2
Language: PHP
Posted by: petecocoon
Added: Nov 15, 2011 2:04 PM
Views: 63
Those headers works fine with all major browser
  1. $filename = 'MyFile.pdf';
  2. $size = 4096; //4k
  3. header('Content-Description: File Transfer');
  4. header('Content-Type: application/octet-stream');
  5. header('Content-Disposition: attachment; filename='.$filename);
  6. header('Content-Transfer-Encoding: binary');
  7. header('Expires: 0');
  8. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  9. header('Pragma: public');
  10. if ($size) {
  11.   header('Content-Length:' . $size);
  12. }