note 109302 modified in function.header by danbrown
| From: | danbrown@php.net | Date: | Mon, 16 Jul 2012 15:51:02 +0000 |
| Subject: | note 109302 modified in function.header by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189232@lists.php.net to get a copy of this message | ||
A proper way to encode a filename in Content-Disposition header is described in RFC
5987. However, that is not supported in IE below 9, so you need a
fallback. You can not send two Content-Disposition headers, but you can set two
filename attributes: <?php $simple =
'file.jpg'; $fancy = 'my ⬠balance ¤
½.jpg'; header('Content-Disposition: attachment;
filename='.$simple.';
filename*=utf-8\\'\\''.rawurlencode($fancy)); ?>
--was--
A proper way to encode a filename in Content-Disposition header is described in RFC 5987.
However, that is not supported in IE below 9, so you need a fallback.
You can not send two Content-Disposition headers, but you can set two filename attributes:
<?php
$simple = 'file.jpg';
$fancy = 'my ⬠balance ¤ ½.jpg';
header('Content-Disposition: attachment; filename='.$simple.';
filename*=utf-8\'\''.rawurlencode($fancy));
http://php.net/manual/en/function.header.php