You can also use the following code: <?php $file = filter_input(INPUT_GET, 'file'); $filename = basename($file); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=\"{$filename}\";"); readfile("your file path {$file}"); ?>
This will cause any file extensions such as (.pdf, .docx, .zip, .csv, .txt, .html, .php, etc.) without opening directly in a new browser.
Suman Immortal Maharzan
source share