//The following are for extensions that shouldn't be downloaded //The following are for extensions that shouldn't be downloaded case "php": case "css": case "js": case "htm": case "html": case "txt": die("<b>Cannot be used for " . $file_extension . " files!</b>"); break; default: $ctype = "application/force-download"; } header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: {$ctype}"); $header = "Content-Disposition: attachment; filename=" . $filename . ";"; header($header); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . $len); echo file_get_contents($this->location); exit; } } // catch the download url and run the download if (isset($_GET['force-download']) && 'true' == $_GET['force-download']) { Downloader::lookup($_GET['file'])->download(); }