note 72228 added to function.header

From: Date: Mon, 08 Jan 2007 17:43:54 +0000
Subject: note 72228 added to function.header
Groups: php.notes 
Request: Send a blank email to php-notes+get-121455@lists.php.net to get a copy of this message
[Quote] Asim Siddiqui 20-Oct-2006 06:26 For those having the problem with IE adding underscores to spaces... here's a workaround: $filename = 'test file with spaces.txt'; if(stristr($_SERVER['HTTP_USER_AGENT'],'MSIE') !== FALSE) { $filename = str_replace(' ','%20',$filename); // replace space with %20 so IE will read it as a space } header('Content-Disposition: attachment; filename="'.basename($filename).'";'); readfile($fileLocation); [/Quote] You can also use urldecode($string) for replacing all the charachters from de url and not only the white space "%20". So the code will be: $filename = urldecode($filename); // replace space with %20 so IE will read it as a space ---- Server IP: 193.190.198.20 Probable Submitter: 84.197.21.55 ---- Manual Page -- http://www.php.net/manual/en/function.header.php Edit -- https://master.php.net/note/edit/72228 Del: integrated -- https://master.php.net/note/delete/72228/integrated Del: useless -- https://master.php.net/note/delete/72228/useless Del: bad code -- https://master.php.net/note/delete/72228/bad+code Del: spam -- https://master.php.net/note/delete/72228/spam Del: non-english -- https://master.php.net/note/delete/72228/non-english Del: in docs -- https://master.php.net/note/delete/72228/in+docs Del: other reasons-- https://master.php.net/note/delete/72228 Reject -- https://master.php.net/note/reject/72228 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#121455) next »