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
+1
source to share
3 answers