Accessed as such:  http://localhost/forcedownload.php?file=../images/mustdownload.jpg
<?php
$filename = $_GET[’file’];
//check for existence of file first if not there die.
if(!file_exists($filename))
{
exit();
//for testing:
//die(’Error: File not found.’);
}
//could be used to test to make sure that only files from a particular directory are accessed
$baseurl = str_replace($DOCUMENT_ROOT, ”, dirname($filename));
$fileextension = strtolower(substr(strrchr($filename,’.’),1));
//make sure that we are only trying to download files with an image extension.  An […]

Continue reading " Force File Download "