require_once("config/config.php");

$path = $download_path;

if (isset($_GET["file"])) 
{
	$filename = $_GET["file"];
	$filename = ereg_replace(" ","+",$filename);
	$path = $path.$filename;
	
	header("Content-type: ".detect_mime($filename));
	header("Content-Transfer-Encoding: binary");
	header("Content-Length: ". filesize($path));
	header("Content-Disposition: Attachment; filename=". basename($filename));
	readfile($path);
	exit;
}
else {
	header("HTTP/1.0 404 Not Found");
	echo "File not found.";
	exit;
}