We have some PDF files and instead of giving direct link to to file, we want it to render through php so that only authenticated users are able to download the pdf file. Thus we dont need to give filepath to user.
Is it possible?
Mangesh
We have some PDF files and instead of giving direct link to to file, we want it to render through php so that only authenticated users are able to download the pdf file. Thus we dont need to give filepath to user.
Is it possible?
Mangesh
 
    
    You can, here is a sample:
<?php
$file = './path/to/the.pdf';
$filename = 'You dont know where I am.pdf';
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);
?>
