Skip to content

Instantly share code, notes, and snippets.



Last active Aug 29, 2015
What would you like to do?
$mime_type = 'application/pdf';
$file_path = '/path/to/pdf';
// for IE 8 ( see )
$expires = 30;
header("Last-Modified: ". gmdate("D, d M Y H:i:s", filemtime($file_path)). " GMT");
header("Expires: " . date(DATE_RFC1123, time() + $expires));
header("Pragma: cache");
header("Cache-Control: max-age={$expires}");
header("Cache-Control: cache");
// for IE 8
header('Content-Disposition: inline; filename="'.basename($file_path).'"');
header('Content-Length: '.filesize($file_path));
header('Content-Type: '.$mime_type);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.