* @link https://TheTempusProject.com * @license https://opensource.org/licenses/MIT [MIT LICENSE] */ namespace TheTempusProject\Controllers; use TheTempusProject\Hermes\Functions\Redirect; use TheTempusProject\Bedrock\Functions\Session; use TheTempusProject\Bedrock\Functions\Check; use TheTempusProject\Bedrock\Functions\Input; use TheTempusProject\Hermes\Functions\Route as Routes; use TheTempusProject\Houdini\Classes\Issues; use TheTempusProject\Houdini\Classes\Views; use TheTempusProject\Houdini\Classes\Components; use TheTempusProject\Houdini\Classes\Template; use TheTempusProject\Classes\Controller; use TheTempusProject\Classes\Forms; use TheTempusProject\TheTempusProject as App; class Downloads extends Controller { public function index() { Session::flash( 'success', 'Unknown download.' ); return Redirect::to( 'home/index' ); } public function resume( $extension = 'none' ) { if ( ! in_array( $extension, ['docx','pdf','md','txt'] ) ) { Session::flash( 'success', 'Unknown download.' ); return Redirect::to( 'home/index' ); } $file = APP_ROOT_DIRECTORY . 'downloads' . DIRECTORY_SEPARATOR . 'JoeyKimsey-resume-2025.' . $extension; // Check if the file exists if (file_exists($file)) { // Set headers to force the download header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . basename($file) . '"'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); // Clear the output buffer ob_clean(); flush(); // Read and output the file readfile($file); exit; } else { Session::flash( 'success', 'Unknown download.' ); return Redirect::to( 'home/index' ); } } }