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

Form Help
Here is the form:

Line number On/Off | Expand/Contract<? include("../include/sess

Need help: how to catch acess of undefined class properties
Hello. I am learning OO with PHP and have hit a problem.
Some code runs as perfectly valid code,

how make 2 column in table with data tybe long row
hi every one

I want make in my table 2 column with data tybe long raw

how thi

output_buffering so rewrite
I'm planning to rewrite some of my scripts so they don't have to use output buffering to accomplish

Where am I going wrong
Been trying to work this out for hours

I have two tables called 'Genres' and 'Films'. Genre

how to timeout $doc = new DOMDocument()->load($url)
I am currently using this $doc->load($url) to fetch an rss feed.
If a feed takes long than

Display last record first.
I need some help how put the last record first and first record last.

Thanks

Code: &am

Check before inserting in DB ???
This is my code
---------------
if ( $_POST ['Submit'])
{{
$username = $_POST ['usernm

Is it possible to view php source code??
Hi All

I was just wondering if it's possible to view a websites php source code?
I know

PHP doesn't send my mail
Hi all, I found this and used it to send mail. Simple contact form with some required fields. The va

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