<?php
include_once("../../../auth.php");
if (isset($_GET['uuid']) && $_GET['uuid'] != "" && isset($_GET['filename']) && $_GET['filename'] != ""){
	$fileUUID = $_GET['uuid'];
	$filename = strip_tags($_GET['filename']);
	$chunks = glob("chunks/" . $fileUUID . "/" . $fileUUID . "_*");
	if (count($chunks) > 0){
		//The number of chunks is more than 0. Save to proceed
		$output = shell_exec('arozdfs.exe upload -storepath "' . $fileUUID . '" -uuid "' . $fileUUID . '" -vdir ' . $filename); //Change this line to other binary if you are not running on Window Host
		echo $output;
	}else{
		die("ERROR. Targeting file not exists.");
	}
	
}else{
	die("ERROR. Undefined filename or uuid.");
}
?>