<?php
//Include auth here
//To be implemented
include_once("checkToken.php");
$storageDir = file_get_contents("storageDirectory.config");
if (in_array("mod_xsendfile",apache_get_modules())){
	if (isset($_GET['chunkuuid'])){
		$path = str_replace("../","",$storageDir . $_GET['chunkuuid']);
		if (file_exists($path)){
			header("X-Sendfile: $path");
			header("Content-Type: application/octet-stream");
			header("Content-Disposition: attachment; filename=\"$path\"");
			exit;
		}else{
			die("ERROR. File not exists.");
		}
	}
}else{
	die("ERROR. mod_xsendfile not installed and it is required.");
}


?>