Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $file = "";
- if( isset($_GET['file']) ) $file = $_GET['file'];
- if( ! $file ) exit;
- $uploadpath = "upload/";
- $filepath = $uploadpath . $file;
- if( ! file_exists($filepath) ) exit;
- $filesize = filesize($filepath);
- $fileinfo = pathinfo($filepath);
- $filename = $fileinfo['basename'];
- $extension = $fileinfo['extension'];
- header("Pragma: public");
- header("Expires: 0");
- header("Content-Type: application/octet-stream");
- header("Content-Disposition: attachment; filename=\"$filename\"");
- header("Content-Transfer-Encoding: binary");
- header("Content-Length: $filesize");
- ob_clean();
- flush();
- readfile($filepath);
Add Comment
Please, Sign In to add comment