$maxsize) { die('TOO BIG!'); } // too big file $localfname = $_POST['fname']; $data = file_get_contents($_FILES['data']['tmp_name']); $file = fopen($thefiledata, 'wb'); fwrite($file, $data); fclose($file); $filename = fopen($thefilename, 'wb'); fwrite($filename, $localfname); fclose($filename); die('DONE'); } if (isset($_GET['type']) && $_GET['type'] === 'download') { if (!file_exists($thefiledata) || !file_exists($thefilename)) { echo '