excellent, thank you kevinkorb! Ah yea I thought the /download would point to the site_root instead of the server_root. Quick question, Is it possible to create a global site_root variable for this?
for example:
/root
/public_html
-> /example.com
-> /download.php
-> /download
-> new.txt
Could this be done. I would create a global variable named base_dir=/example.com and use $base_dir/download. My goal is to re-do the code, clean it up a bit and to re-organize the source and files into more meaningful names. By cleaning up and updating the code with global variables this would make the source more manageable.
so with your update I would like if this could be done. This is probably a bad example but if lets say for example your adding global variables to a source file full of image links where instead of changing all paths you just need to change it in once at the top.
base_dir=/example.com
$file='$base_dir/download/new.txt';
$type='text/plain';
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: ".$type);
header("Content-Disposition: attachment; filename=\"".basename($file)."\";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($file));
readfile($file);