<?php
include '../auth.php';
?>
<?php
$data = $_POST["data"];
list($type, $data) = explode(';', $data);
list($encode, $data) = explode(',', $data);
if($filetype == "data:application/pdf"){
	die("ERROR: UNSUPPORTED FILE FORMAT");
}
if($encode == "base64"){
	$data = base64_decode($data);
	file_put_contents($_POST["fname"], $data);
}else{
	file_put_contents($_POST["fname"], $_POST["data"]);
}

echo "Saved.";
?>