$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 '
NO FILE UPLOADED YET
CLICK TO RELOAD
'; exit; } $fname = file_get_contents($thefilename); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . $fname . '"'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($thefiledata)); readfile($thefiledata); if ($autoeraseafterdownload) { unlink($thefiledata); unlink($thefilename); } exit; } ?> Yopp
UPLOAD
DOWNLOAD