note 72228 deleted from function.header by tularis

From: Date: Fri, 20 Apr 2007 14:15:19 +0000
Subject: note 72228 deleted from function.header by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-125626@lists.php.net to get a copy of this message
Note Submitter: mr.joris[at]gmail.com ---- [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

« previous php.notes (#125626) next »