Created
July 28, 2015 16:35
-
-
Save SohanChy/40239be3a82107d651b2 to your computer and use it in GitHub Desktop.
Try to show a PDF instead of download.
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
<?php | |
$file = './path/to/the.pdf'; | |
$filename = 'Custom file name for the.pdf'; /* Note: Always use .pdf at the end. */ | |
header('Content-type: application/pdf'); | |
header('Content-Disposition: inline; filename="' . $filename . '"'); | |
header('Content-Transfer-Encoding: binary'); | |
header('Content-Length: ' . filesize($file)); | |
header('Accept-Ranges: bytes'); | |
@readfile($file); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment