Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fpdf Output('filename.pdf','F'); downloading file on browser instead of saving it on the server

Tags:

fpdf

When running code the file is the pdf file is getting saved in the browser instead of it getting saved on the server

fpdf Output('filename.pdf','F'); 

downloading file on browser instead of saving it on the server

like image 955
user3766591 Avatar asked Mar 18 '15 11:03

user3766591


1 Answers

As explained in the FPDF documentation, you have to use the D as parameter to the output function to send the PDF to the browser and force a file download with the name given by name:

Output('D','filename.pdf');

For reference, here are the different values for the destination parameter:

I: send the file inline to the browser. The plug-in is used if available. The name given by name is used when one selects the "Save as" option on the link generating the PDF.
D: send to the browser and force a file download with the name given by name.
F: save to a local file with the name given by name (may include a path).
S: return the document as a string. name is ignored.

like image 165
Veve Avatar answered Oct 09 '22 07:10

Veve