Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // do all your processing of info received to determine which file to send, etc..
- $file = '/path/to/file/to/download.txt';
- $filesize = filesize($file);
- header('Content-Description: File Transfer');
- header("Content-type: application/forcedownload");
- header("Content-disposition: attachment; filename=\"filename to display.txt\"");
- header("Content-Transfer-Encoding: Binary");
- header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
- header('Pragma: public');
- header("Content-length: ".$filesize);
- ob_clean();
- flush();
- readfile("$file");
- exit;
- ?>
Add Comment
Please, Sign In to add comment