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.

Did you know?Explore Trending and Topic pages for more stories like this.

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

max() problem
I have a while loop to get image names.
Code: $imagequery = mysql_query("SELECT * FROM ad_i

COOIS - Saving Object Overview WIP Status layouts
COOIS - Would like to be able to save the layout of an Object Overview - WIP Status report. There i

Target costs on Process orders not calculating
Hi All,

We have released standard costs for all the materials. We have also done Goods r

Why is this function returning a false value when it shouldn't be??
This is in an include file. I want it to check a value in an html form and see if it's just white s

DateTimeZone::listIdentifiers headache
http://php.net/manual/en/datetimezone.listidentifiers.php


So the documentation states tha

Weird problem with SELECT command..Help!
Hi!

It seems I'm having a really weird problem with SQL SELECT command....I have table into a

How to set pass login name from htaccess to php
When the user logs into my members page via htaccess, I'd like to retain the username so that I can

Extract text from string
Hi folks,

I have a string that looks like this:

aaaaaaaaaa:
bbbbbbbbbb (ccccccccc)

Preventing blank or already entered values
Im trying to learn how to place a read file line by line and prevent duplicate entries and also BLAN

highlighting search terms
well, I started this in the regular PHP section, but it no longer fits there. Suffice it to say, I'm

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