Hi everyone,
I've brought this up before... but no one seemed to know at the time (and it was in a different forum). A cookie for anyone who can tell me how to get a PDF file from a directory that is NOT accessible from the web to be passed through to a visitor's browser such that it is opened in the browser (assuming the user has Acrobat/Reader installed).
This is what I've tried, to no avail...
$dir="C:/protected_files/"; //this is the "offline" directory in which the protected files are stored
if (isset($_REQUEST["file"])) { //checks to see if a file name was specified in the referring URL
$file=$dir . $_REQUEST["file"]; //if so, the $file variable is set to the name that was specified
if (file_exists("$file")) { //checks to see if the requested file actually exists, and if it does, it gets passed through to download
header("Content-type: application/pdf");
header("Content-Transfer-Encoding: Binary");
header("Content-length: " . filesize($file));
header("Content-disposition: inline; filename=" . basename($file) . "");
}
Thanks a mil!