So I'm using the following code to read PDFs that are stored in a dir outside of webroot.
session_start();
include("../../auth.php");
$file = '/xxx/users/u60/yyy/securedirs/'. $_SESSION['strDir'] .'/'. $_GET['file'];
header("Content-Description: File Transfer");
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=".basename($file));
@readfile($file);
When I need to link to any of these PDFs I use the following as a link on the front end:
getfile.php?file=mypdf.pdf
This works fine if the user saves the PDF to disk and views it ,either by selecting "Save" from the file download prompt, or right click "Save Target As". It doesn't work when the user selects "Open" from the file download prompt. It brings up Adobe Reader and says the file cannot be found.
Is this a limitation due to the way I'm reading the file from the dir outside webroot?