Created
October 8, 2015 03:34
-
-
Save GoldenEra/7ca6127af9cd1d1f5c9c to your computer and use it in GitHub Desktop.
dowload pdf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ob_start(); | |
$file = $_GET['doc']; | |
if(!file_exists($file)) | |
$file = dirname(__FILE__).'/wp-content/plugins/flexpaper/pdf/'.$file; | |
if (file_exists($file)) | |
{ | |
header('Content-Description: File Transfer'); | |
header('Content-Type: application/octet-stream'); | |
header('Content-Disposition: attachment; filename='.basename($file)); | |
header('Content-Transfer-Encoding: binary'); | |
header('Expires: 0'); | |
header('Cache-Control: must-revalidate'); | |
header('Pragma: public'); | |
header('Content-Length: ' . filesize($file)); | |
ob_clean(); | |
flush(); | |
readfile($file); | |
exit(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment