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

Casting Decimals in Oracle
This code worked as a query in DB2, but I am not sure what the syntax is for casting decimals in Ora

Checking if field is empty AND using !is_numeric
Hi lads,

Need to be able to display an error message (using isset?) that says "Cant lea

i have no idea why this isn't working
Code: <?php
session_start();
include("connect.php");

error_reporting(E

Need help with a mail notify function
I was tasked with setting up a site that's been prewritten. The site is basically a form that captur

Trying to add functions to table
I have this list of characters and I'm trying to figure out what I have to do to put the results of

database design
Hi,

I got a page which allow candidate to type in their previous working experience,
I let

What makes a script your own?
If someone finds a login script online, and changes some variable names around and some other minor

square instead of number
Hello
I do not know why but this code seems to work fine only in my xampp local insallation but n

Locking mysql tables with php
Hi

BACKGROUND:
I have multiple instances of the same php script running in a WAMP environ

Solution to the FindControl problem
I have seen may posts about having problems with the FindControl method. Most seem to come about bec

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