I just made a post about downloading outside of a webroot, but the post was so confusing and not REALLY asking any questions, I sat back, thought it out and am now asking, what I feel, is a much clearer question.
Okay.
I have a page [URL=”http://dave.wickedsmaat.com”]HERE[URL=”http://www.haroldbakker.com/php/listing.php”]HERE
[code=php]echo “<tr><td class=”” . usecolor() . “”><a href=”” . rawurlencode($filenames[$i]) . “”>”. $filenames[$i] . “</a></td></tr>
to make the generated file names into Hyperlinks.
What I’m wanting to do, if possible, is have it so when the hyperlink is clicked, the name of the file & it’s location ( /home/username/files/test.avi — NOT — /www/subdomain/test.avi ) are passed into the “$file” variable located inside my “Download.php” script, seen here:
[code=php]
<?php
$file = ‘NAME.EXTENTION’;
if (file_exists($file)) {
header(‘Content-Description: File Transfer’);
header(‘Content-Type: application/octet-stream’);
header(‘Content-Disposition: attachment; filename=’.basename($file));
header(‘Content-Transfer-Encoding: binary’);
header(‘Expires: 0’);
header(‘Cache-Control: must-revalidate, post-check=0, pre-check=0’);
header(‘Pragma: public’);
header(‘Content-Length: ‘ . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
?>
How do I do this??? ???