Content-Disposition: attachment; filename=... not working as i thought it should


Posted on 16th Feb 2014 07:03 pm by admin

taken the following code from the php.net site the script is not working.

what is not happening is the file does not show and also the file download does not show the correct file name it seems to have the file name but has replaced the / with an underscore.


Code: [Select]<?
$PDFtoview = "minutes/PDF filename.pdf";


// outputting a PDF
header('Content-type: application/pdf');

// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="' . $PDFtoview . '"');

// The PDF source is in original.pdf
readfile("'" . $PDFtoview . "'");
//echo($siteurl.$filename);
}
?>

No comments posted yet

Your Answer:

Login to answer
171 Like 31 Dislike
Previous forums Next forums
Other forums

BAPI BBP_INB_DELIVERY_CREATE - material number missing in delivery
Hi Experts,

I was able to successfully create an Inbound delivery with reference to a PO

Changes to hosting company's server has affected web contact form
I started a thread a couple of months ago about the contact forms on my client's website. Basically

unexpected T_STRING
error log "[Sat Jan 09 18:27:58 2010] [error] [client 127.0.0.1] PHP Parse error: syntax error

php redirecting
i wont open a new thread but i have a question about redirecting....
i wonder why my code doesnt

printing links
Hi every1

i am connecting to a table in sql and the looping through with a while ($ var = my

HeaderSelectedCssClass not working
I have an accordian where I have a drop down list in the first pane and a grid in the second pane.

Whats wrong with my query?
I am trying to get this query to show the appropriate ticked vehicle roof height, unless no boxs are

How to give the privillege for triggers?
Hi,

How to give the privillage for triggers to particular user?

Please let me

Random Number Generation And Probability
Hello, I am working on a function which has to insert data into a SQL table.

we have to suppl

Session variable help
I'm having a very troubling issue. Maybe I'm just looking over something but I have looked at the co

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash