note 72544 deleted from function.header by nlopess

From: Date: Tue, 23 Jan 2007 23:34:39 +0000
Subject: note 72544 deleted from function.header by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-122093@lists.php.net to get a copy of this message
Note Submitter: sarimarton at gmail dot com ---- Filenames in the browser's download dialog can be a bit problematic, when it contains spaces or non-ASCII characters. Firefox cuts at space, 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\""); ?>

« previous php.notes (#122093) next »