skip to Main Content

Php – Changing the URL title while serving a PDF file

I have a simple PHP file download script, <?php $file = sprintf("/home/data/files/%d", intval($_GET['id'])); if (! file_exists($file)) { die("no such file"); } if (str_ends_with($_GET['name'], ".pdf")) { header("Content-Type: application/pdf"); } else { header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename="" . $_GET['name'] . """); }…

VIEW QUESTION
Back To Top
Search