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

Am I setting up my sites oldschool?
Ok,

When I create a site I open a basic template that I have created that consists of a css f

php web service error
hey guys,
I'm working on a project requires the use of web services. I've been trying a few tutor

Scheduler problems related to execution of a single BLT by many schedules
Hello all,

We are running several MII instances in a distibuted architecture using a sing

convert PHP array to Javascript array
I have a page that gets a request sent from AJAX, and I am trying to convert a PHP array to a javasc

Change of partner analyse in sales orders
Hello,

I changed the partner analyse for sales orders and added a new mandatory partnerro

simplexml and xpath - Need some help
Hello,

I am trying to parse an xml which comes back from Amazon and I am trying to know how m

Why does my php page download images over and over
Can anybody please explain to me why my php page keeps downloading the images and other items every

UPLOAD IMAGES NOT WORKING!
Hi there i have a upload script in which it uploads the picture to a folder than creates two thumbna

Sql and php order list script problems
Hi im having a few problems with trying to get the coding right on a orders list ive done (or trying

array ...
hi
Code: function formatCategories($categories, $parentId)
{
// $navCat stores all child

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