Hello,
I am trying to load a document into a web page that exists outside the live directory. I have all my web sites loaded into vhtdocs, I want to create a new directory that is not accessible via a URL that will contain various documents (pdf, doc, xls). When a user selects a document it is to be loaded into a buffer and sent to them, I have this code so far, but the document always comes back empty, but if I move it to a live URL the document comes through fine. Any ideas on why this is?
[url]http://site_url/download.php?document=myfile.pdf[/url]
download.php code:
header("Content-disposition: filename=".$download);
header("Content-type: ".$stream);
header("Pragma: no-cache");
header("Expires: 0");
$handle=fopen(FILE_PATH.$download, "r");
$contents="";
while (!feof($handle)) {
$contents.=fread($handle, 4096);
}
PRINT($contents);
fclose($handle);