. */ $file = '/tmp/cv.tar'; $json = '/tmp/json'; try { $a = new PharData($file); file_put_contents ($json, $_POST['json']); $a->addFile('../cv.html', 'cv/cv.html'); $a->addFile('../demo.html', 'cv/demo.html'); $a->addFile('../js/cv.js', 'cv/js/cv.js'); $a->addFile('../cvgen.html', 'cv/cvgen.html'); $a->addFile('../js/reglages.js', 'cv/js/reglages.js'); $a->addFile('../js/cvgen.js', 'cv/js/cvgen.js'); $a->addFile('../js/info.js', 'cv/js/info.js'); $a->addFile('../js/content.js', 'cv/js/content.js'); $a->addFile('../server/ping.php', 'cv/server/ping.php'); $a->addFile('../server/archive.php', 'cv/server/archive.php'); $a->addFile('../server/download.php', 'cv/server/download.php'); $a->addFile('../js/bootstrap.min.js', 'cv/js/bootstrap.min.js'); $a->addFile('../js/jquery.min.js', 'cv/js/jquery.min.js'); $a->addFile('../js/trianglify.min.js', 'cv/js/trianglify.min.js'); $a->addFile('../js/background.js', 'cv/js/background.js'); $a->addFile('../css/bootstrap.min.css', 'cv/css/bootstrap.min.css'); $a->addFile('../css/cv.css', 'cv/css/cv.css'); $a->addFile('../css/cvgen.css', 'cv/css/cvgen.css'); $a->addFile($json, 'cv/data/cv.json'); $a->addFile('../README.md', 'cv/README.md'); $a->addFile('../data/demo.json', 'cv/data/demo.json'); $a->addFile('../icons/johndoe.jpg', 'cv/icons/johndoe.jpg'); $a->addFile('../LICENSE', 'cv/LICENSE'); $a->addFile($_FILES['uploadFileImage']['tmp_name'], $_POST['img']); $a->compress(Phar::GZ); } catch (Exception $e) { } $file= $file. ".gz"; if (file_exists($file)) { $b64 = base64_encode(file_get_contents($file)); header('Content-Description: File Transfer'); header('Content-Type: application/x-tgz'); header('Content-Disposition: attachment; filename='.basename($file)); header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . /*filesize($file)*/ strlen($b64)); ob_clean(); flush(); ob_get_clean(); echo $b64; ob_end_flush(); unlink($file); exit; } ?>