Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    358
    Thanks
    2
    Thanked 0 Times in 0 Posts

    IE7 File download replaces spaces with underscore.

    IE7 File download replaces spaces with underscore.
    My code:
    ...

    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.
    Thanks.
    =====================================================
    From NinjaTurtle
    ++http://ohmygoh.blogspot.com|http://technology.ohmygoh.com++

  • #2
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,043
    Thanks
    19
    Thanked 42 Times in 42 Posts
    PHP Code:
    $strFilename=urlencode('My Report.doc'); //changes the space to %20 which refers to a space 
    HTH
    Rafiki

    /*off topic*/
    1500th post
    /*/off topic */


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •