This question is for those who have used PHP library FPDF (http://www.fpdf.org ) to generate PDF documents using PHP. I am generating a PDF file using the php file ‘my_file.php’. I want users to be able to download that PDF file. But in the browser the see the file in the address bar as ..somepath…./my_file.php . I want them to see it as a file with .pdf extension. Any idea how this can be done ?
This question is for those who have used PHP library FPDF (http://www.fpdf.org ) to
Share
You can’t change the browser address bar, but you can change the address on your server. For example if you’re using Apache, there’s
mod_rewritewhich allows you to do such things.If your problem is that when downloading the file, the browser wants to save it as .php, you could use those headers to force the download and a filename.