SHARE
TWEET

Untitled

a guest Nov 14th, 2017 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3.   if (isset($_POST['name'])) {
  4.     $filePath = "pdfurl-guide.pdf";
  5.     header("Content-Type: application/octet-stream");
  6.     header("Content-Disposition: attachment; filename=" . basename(urlencode($filePath)));  
  7.     header("Content-Type: application/octet-stream");
  8.     header("Content-Type: application/download");
  9.     header("Content-Description: File Transfer");  
  10.     $fp = fopen($filePath, "r");
  11.     while (!feof($fp)) {
  12.       echo fread($fp, 65536);
  13.       flush();
  14.     }
  15.     fclose($fp);
  16.     die();
  17.   }
  18.  
  19. ?>
  20.  
  21. Please fill out the following form to download:
  22. <form method="post" action="">
  23.   Name: <input type="text" name="name" /><br />
  24.   <input type="submit" />
  25. </form>
RAW Paste Data
Top