I pass the location of the php file that contains the following code as parameter to the viewer.html
file and it is displayed correctly but when clicking the download button in the pdf viewer the document name is always document.pdf
. This poses a problem because of how many mobile users will be downloading files only to discover that all of their files have the the name document.pdf
and that they (for most mobile browsers) can't change the filename before downloading.
Do I have to pass some arbitrary parameter to the file or redirect to self with the filename appended?
<?php
$content = "a binary representation of my pdf";
header("Content-type: application/pdf");
header('Content-Transfer-Encoding: binary');
header('Content-Disposition: attachment; filename="someFile.pdf"');
echo $content;
?>