From: Ashley Sheridan on
On Mon, 2010-03-01 at 12:14 +0100, Kim Madsen wrote:

> Ashley Sheridan wrote on 01/03/2010 07:13:
>
> > The HTTP header doesn't treat quoteation marks in the same way that PHP
> > does. It needs double quote marks to function correctly.
>
> How do you mean? And do you have a link to this information?
>
> Even if this is true, then the first Nick did should still be correct?
>
> header('Content-Disposition: attachment; filename="PurchaseReq.doc"');
>
> I'm using the same headers for downloads, allthough I use double qoutes
> for the header function aswell:
>
> header("Content-Disposition: attachment; filename=\"artist - title.mp3\"");
>
> --
> Kind regards
> Kim Emax - masterminds.dk
>


I only meant for the quotes around the filename. I'd tried

header("Content-Disposition: attachment; filename='artist -
title.mp3'");

before and it didn't work correctly. I hadn't run into the problem of
double quotes inside singe though, as the filenames I was generating
relied on a variable, and I found it easier to just escape the second
set of nested quotes and include the variable directly.

As far as I'm aware, the header() function shouldn't care whether it
uses single or double quotes, so I would assume it's something else
amiss.

Thanks,
Ash
http://www.ashleysheridan.co.uk