The content-disposition header is not part of HTTP (but popular to use with HTTP requests), see in RFC 2616.
The documentation of it is part of RFC 2183 which is in the MIME domain. It's specified as filename-param
of which the filename is actually the value
part. That value
is defined in RFC 2045 Appendix A -- Collected Grammar
as:
value := token / quoted-string
token := 1*<any (US-ASCII) CHAR except SPACE, CTLs,
or tspecials>
tspecials := "(" / ")" / "<" / ">" / "@" /
"," / ";" / ":" / "\" / <">
"/" / "[" / "]" / "?" / "="
; Must be in quoted-string,
; to use within parameter values
See as well RFC 2616, 2.2 Basic Rules.
It's all US-ASCII
and I assume the space needs escaping, e.g. multiple words in double-quotes (other chars work as well for that quoted string
, token
is a single word):
header('Content-disposition: attachment; filename="test file.pdf"');
Keep in mind that other chars need other escaping/encoding, see RFC 2047 and this pear ticket.
But in the end you need to test with every browser. I think it's easier if you replace the space with a _
or -
inside the filename to be more stable:
header('Content-disposition: attachment; filename=test-file.pdf');
Hope this is helpful to understand your issue.