note 109302 modified in function.header by danbrown

From: 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.&#13;&#10;However, that is not supported in IE below 9, so you need a fallback.&#13;&#10;You can not send two Content-Disposition headers, but you can set two filename attributes:&#13;&#10;&#13;&#10; &#60;?php&#13;&#10; $simple = &#39;file.jpg&#39;;&#13;&#10; $fancy = &#39;my € balance ¤ ½.jpg&#39;;&#13;&#10; header(&#39;Content-Disposition: attachment; filename=&#39;.$simple.&#39;; filename*=utf-8\\&#39;\\&#39;&#39;.rawurlencode($fancy));&#13;&#10; ?&#62; --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

« previous php.notes (#189232) next »