daily pastebin goal
75%
SHARE
TWEET

Untitled

a guest Jul 12th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     public function fetchFile() {
  3.         if(!Globals::$user) {
  4.             die('You can not download files if you are not logged in.');
  5.         }
  6.        
  7.         $file->path = "../_private/1/Pragmatic.Textmate.Power.Editing.for.the.Mac.Feb.2007.pdf";
  8.         $file->name = basename($file->path);
  9.        
  10.         if(file_exists($file->path)) {
  11.             header('Content-Type: application/octet-stream');
  12.             header("Content-Disposition: attachment; filename=\"{$file->name}\"");
  13.             header("Content-Length: " .(string)(filesize($file->path)) );
  14.             readfile($file->path);
  15.         }
  16.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top