...

View Full Version : IE7 File download replaces spaces with underscore.



NinjaTurtle
03-04-2008, 06:55 AM
IE7 File download replaces spaces with underscore.
My code:
...



$strFilename="My Report.doc";
fwrite($fp, $data);
fclose($fp);
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Pragma: no-cache");
header("Cache-Control: must-revalidate");
header("Content-type: application/octet-stream");
header("Content-type: text/comma-separated-values");
header("Content-Disposition: attachment; filename=$strFilename");
header("Expires: 0");
readfile($strFilename);

When i download the file:
It becomes : My_Report.doc

Why? Is it a bugs? And what is the best solution, instead of ask me to remove the code by using string replace.

Thanks.

rafiki
03-04-2008, 04:11 PM
$strFilename=urlencode('My Report.doc'); //changes the space to %20 which refers to a space

HTH
Rafiki

/*off topic*/
1500th post :D
/*/off topic */



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum