<?php
include_once("../../../auth.php");
if (isset($_GET['filename']) && $_GET['filename'] != ""){
	$fileToBeSliced = $_GET['filename'];
	if (isset($_GET['chunksize']) && $_GET['chunksize'] != ""){
		$sliceSetting = " -slice " . $_GET['chunksize'];
	}else{
		$sliceSetting = "";
	}
	if (file_exists("uploads/" . $fileToBeSliced) && strpos(realpath("uploads/" . $fileToBeSliced),realpath("uploads/")) !== false){
		$output = shell_exec("arozdfs.exe slice -infile uploads/" . $fileToBeSliced . $sliceSetting); //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 for slicing.");
}
?>