Niels
Niels

Reputation: 597

Chrome embedded PDF download filename

I have the following that visually embeds the pdf on 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 chrome internal pdf viewer, the suggested filename shows as get_file, but I want it to be Project Report project_102587.pdf like in the title attribute. How can I do that?

Upvotes: 4

Views: 7175

Answers (2)

chamoosong
chamoosong

Reputation: 1

embed is to get file name from url

from

modules/files/actions/get_file.php?id=134

to

modules/files/actions/get_file.php/Project_Report_project_102587.pdf?id=134

Upvotes: 0

Oskyk
Oskyk

Reputation: 448

in get_file.php add header that contains filename (add it before data stream)

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

Upvotes: 2

Related Questions