Results 1 to 19 of 19

Thread: Getting the extension right on a download [resolved]

Threaded View

  1. #1

    Thread Starter
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090

    Getting the extension right on a download [resolved]

    I'm using this code to download a file:
    PHP Code:
    <?
    //Download a file
    $file = $_GET['file'];
    header("Cache-Control: no-cache, must-revalidate");
    header("Pragma: no-cache");
    header("Content-type: application/x-zip");
    header("Content-disposition: attachment; filename=".$file);
    readfile($file);
    ?>
    I have to use this so that .html files can be downloaded and not simply viewed. I've noticed thought that in IE there is no extension to the file. in FireFox it gives the corrrect file xtension, but not in IE. I've even tried reading the user agent and manually entering an extension for IE. Still didn't work.

    Actually, the file even has different names in the two browsers, neither of which are the name of the real file, they still download correctly though.

    Can someone please tell me why IE doesn't give an extension and how to give it one.
    Last edited by Acidic; May 2nd, 2004 at 09:16 AM.
    Have I helped you? Please Rate my posts.

Posting Permissions

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



Click Here to Expand Forum to Full Width