- basename: documentation ( source)
- flush: documentation ( source)
- readfile: documentation ( source)
- ob_clean: documentation ( source)
- filesize: documentation ( source)
<?php
function eheader($header) { echo $header . PHP_EOL; }
$file = 'monkey.gif';
eheader('Content-Description: File Transfer');
eheader('Content-Type: application/octet-stream');
eheader('Content-Disposition: attachment; filename='.basename($file));
eheader('Expires: 0');
eheader('Cache-Control: must-revalidate');
eheader('Pragma: public');
eheader('Content-Length: ' . filesize($file));
ob_clean();
flush();
@readfile($file);