How to force Save As dialog when streaming PDF attachment
I am using the following code to stream PDF to browser:
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public");
header("Content-type:application/pdf");
header("Content-Disposition:attachment;filename=file.pdf");
echo $pdf;
Works fine except (in Chrome anyway) it just saves the "file.pdf" file - it doesn't ask for the Save As dialog, so I can rename the file if I choose.
I suspect it might be one of those browser dependent things, but is it possible to force the Save As dialog with php headers to be forced when streaming a pdf to download?
Thanks (in advance) for your help
They most likely have a question where to save each file before loading unchecked (Advanced settings). If so, there is nothing you can do as that is their preference.
This behavior is controlled by the browser settings, so I don't think this is a way to force the Save As dialog.
You can try omitting the filename, but I think it just inherits the script name.
You may try:
Content-Type = application/download