Chrome embedded PDF file to download

I have the following that visually inserts a PDF into my page:

<embed src="modules/files/actions/get_file.php?id=134" 
type="application/pdf" 
style="border: 0px; width: 100%; min-height: 500px" 
title="Project Report project_102587.pdf">

when I use the download button of the internal Chrome browser, the suggested file name is displayed as get_file, but I want it to be Project Report project_102587.pdf, as in the title attribute. How can i do this?

+4
source share
1 answer

in get_file.php add a header that contains the file name (add it before the data stream)

header('Content-Disposition: inline; filename="Project_Report_xxxx.pdf"');
+1
source

Source: https://habr.com/ru/post/1649010/


All Articles