DArcher

download.php

Feb 2nd, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. <?php
  2.  
  3. $file = @$_GET['file'];
  4. $parts = explode('/', $file);
  5. $fileName = $parts[sizeof($parts) - 1];
  6.  
  7. if ((isset($file)) && (file_exists($file))) {
  8.     header("Content-type: application/force-download");
  9.     header('Content-Disposition: inline; filename="' . $fileName . '"');
  10.     header("Content-Transfer-Encoding: Binary");
  11.     header("Content-length: " . filesize($file));
  12.     header('Content-Type: application/octet-stream');
  13.     header('Content-Disposition: attachment; filename="' . $fileName . '"');
  14.     readfile($file);
  15. }
  16. ?>
Add Comment
Please, Sign In to add comment