Skip to content

Instantly share code, notes, and snippets.

@martiell
Created May 14, 2014 17:27
Show Gist options
  • Save martiell/b1055156d56d23044c09 to your computer and use it in GitHub Desktop.
Save martiell/b1055156d56d23044c09 to your computer and use it in GitHub Desktop.
The Genius of Creative State.
<?php
$file = urldecode($_GET['F']);
$boom = explode("/", $file);
$count = count($boom);
$file_name = $boom[$count - 1];
header("Content-disposition: attachment; filename=".$file_name);
header("Content-type: application/pdf");
readfile($file);
?>
@martiell
Copy link
Author

index.php:

<?php
if( $_REQUEST['file'] != "" ) {
  header('Content-type: octet/stream');
  header("Content-Disposition: attachment; filename='".$_REQUEST['file']."'");   
  readfile($_REQUEST['file']);
}
?>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment