asimryu

download.php - 한글다운 가능

Aug 2nd, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1. <?php
  2. $file = "";
  3. if( isset($_GET['file']) ) $file = $_GET['file'];
  4. if( ! $file ) exit;
  5. $uploadpath = "upload/";
  6. $filepath = $uploadpath . $file;
  7. if( ! file_exists($filepath) ) exit;
  8. $filesize = filesize($filepath);
  9. $fileinfo = pathinfo($filepath);
  10. $filename = $fileinfo['basename'];
  11. $extension = $fileinfo['extension'];
  12. header("Pragma: public");
  13. header("Expires: 0");
  14. header("Content-Type: application/octet-stream");
  15. header("Content-Disposition: attachment; filename=\"$filename\"");
  16. header("Content-Transfer-Encoding: binary");
  17. header("Content-Length: $filesize");
  18. ob_clean();
  19. flush();
  20. readfile($filepath);
Add Comment
Please, Sign In to add comment