Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1. <?
  2. $file = $_POST['file'];
  3. if ((isset($file))&&(file_exists($file))) {
  4.     header("Content-type: application/force-download");
  5.     header('Content-Disposition: inline; filename="' . $file . '"');
  6.     header("Content-Transfer-Encoding: Binary");
  7.     header("Content-length: ".filesize($file));
  8.     header('Content-Type: application/octet-stream');
  9.     header('Content-Disposition: attachment; filename="' . $file . '"');
  10.     readfile("$file");
  11. } else {
  12.     echo '<h1>No file selected or file does not exist ' . $_POST['file'] . '</h1><a href="index.php">Click here to go back</a>';
  13. } //end if
  14. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement