first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

PHP: readfile() Problem with content-disposition in FireFox

I saw in previous contributed notes that in content-disposition the file is not a quoted-string, there is no problem if the filename have no spaces but if it has in IE it works but in Firefox not. The RFC 2616 puts as an example this: Content-Disposition: attachment; filename="fname.ext" You can see http://www.faqs.org/rfcs/rfc2616.html section "19.5.1 Content-Disposition" for more details. The correct header then is this:

header("Content-Disposition: attachment; filename=\\"$filename\\"");

[http://us.php.net/readfile]

mod date: 2009-08-18T00:18:57.000Z