note 72545 added to function.header
| From: | sarimartonatgmaildotcom at osu1 dot php dot net | Date: | Tue, 23 Jan 2007 22:59:19 +0000 |
| Subject: | note 72545 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-122090@lists.php.net to get a copy of this message | ||
Filenames in the browser's download dialog can be a bit problematic, when it contains spaces or
non-ASCII characters. To set the appropriate cross-browser header, use the following code. It is
assumed that the script receives a query like this: download.php?source=/content/példa
fájl.doc
<?php
$filename = basename($_GET['source']);
$ie = eregi("msie", $_SERVER['HTTP_USER_AGENT']);
if ($ie) $filename = rawurlencode($filename);
/* ... */
header("Content-Disposition: attachment; filename=\"$filename\"");
?>
----
Server IP: 195.56.193.13
Probable Submitter: 80.98.202.194
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- https://master.php.net/note/edit/72545
Del: integrated -- https://master.php.net/note/delete/72545/integrated
Del: useless -- https://master.php.net/note/delete/72545/useless
Del: bad code -- https://master.php.net/note/delete/72545/bad+code
Del: spam -- https://master.php.net/note/delete/72545/spam
Del: non-english -- https://master.php.net/note/delete/72545/non-english
Del: in docs -- https://master.php.net/note/delete/72545/in+docs
Del: other reasons-- https://master.php.net/note/delete/72545
Reject -- https://master.php.net/note/reject/72545
Search -- https://master.php.net/manage/user-notes.php