| 1 | <?php |
| 2 | |
| 3 | //Generic binary file downloading (when file exists) |
| 4 | |
| 5 | $filename = r('f/'.$_GET['f']); |
| 6 | |
| 7 | if (file_exists($filename)) { |
| 8 | header('Content-Description: File Transfer'); |
| 9 | header('Content-Type: application/octet-stream'); |
| 10 | header('Content-Disposition: attachment; filename='.basename($filename)); |
| 11 | header('Expires: 0'); |
| 12 | header('Cache-Control: must-revalidate'); |
| 13 | header('Pragma: public'); |
| 14 | header('Content-Length: ' . filesize($filename)); |
| 15 | ob_end_flush(); |
| 16 | readfile($filename); |
| 17 | exit; |
| 18 | } |
| 19 | |
| 20 | else header('Location: '.r('404')); |