I am having trouble with Chrome and the name Chrome gives a PDF on download.
The file name as read by Chrome:
The name of the file when I click the download button: ControlFile.php
I have narrowed it down to an issue with Chrome PDF Viewer. Altering the headers and URL bar have no effect. If I disable the plugin, it downloads with the correct name.
I have been unable to find a way to change the name that gets generated. Is anyone able to assist me in this?
As requested, here is the code where the content is being named:
header('content-type:application/pdf');
header('Content-Disposition: inline; filename='.$name . '.' . $format);
echo $output;
I checked the headers before the echo using headers_list()
. The issue is only for displaying PDFs on screen and downloading them using the button that appears in chrome, not for when downloading without displaying.