How to force a Save As dialog when streaming a PDF attachment

后端 未结 3 1799
情深已故
情深已故 2021-01-07 11:53

I am using the following code to stream a pdf to the browser:

header(\"Cache-Control: must-revalidate, post-check=0, pre-check=0\"); 
header(\"Pragma: public         


        
相关标签:
3条回答
  • 2021-01-07 12:11

    You could try:

    Content-Type = application/download
    
    0 讨论(0)
  • 2021-01-07 12:19

    That behavior is controlled by the browser settings, so I don't think theres a way to force the "Save as" dialog to be opened.

    You could try not specifying a name for the file, but I do think that it will just inherit the scripts name instead.

    0 讨论(0)
  • 2021-01-07 12:30

    They most likely have Ask where to save each file before downloading unchecked (Advanced Settings). If this is the case, there's nothing you can do as this is their preference.

    0 讨论(0)
提交回复
热议问题