-
Code's Tags
-
Your Codes
-
Reffers
-
Linked Codes
|
Code:
Short link for Twitter:
HTML:
HTML view:
Copy Source | Copy HTML- // simple http download by Sergey Shuchkin
- function download( $filename, $as = false, $exit = false ) {
- header('Content-type: application/octet-stream');
- header('Content-Disposition: attachment; filename="'.($as ? $as : basename($filename)).'"');
- header('Last-Modified: ' . date('D, d M Y H:i:s \G\M\T' , filemtime( $filename ) ));
- header('Content-Length: '.filesize($filename));
- $fp = fopen( $filename, 'rb');
- if ($fp) {
- fpassthru( $fp );
- fclose( $fp );
- }
- if ($exit) exit();
- }
|