I need to create a link for downloading a pdf file .
But sometimes the pdf file will open in the browser and sometimes it will get downloaded.
How can I make sure that the pdf file is always downloaded.
I need to create a link for downloading a pdf file .
But sometimes the pdf file will open in the browser and sometimes it will get downloaded.
How can I make sure that the pdf file is always downloaded.
As this question is a duplicate, I'll just answer to make the answer more clear. Create a php page like this:
myFile.pdf.php
<?php
header('Content-Disposition: attachment; filename="path/to/your/file.pdf"');
?>
and if you call this page (e.g. http://domain.com/myFile.pdf
) it will download the pdf file. Make sure this page and the actual file don't have the same exact name and location!