HTTP Headers...

    Date: 04/26/05 (PHP Development)    Keywords: browser

    A little bit of guidance, if you please...

    I'm writing an application which involves the download of files. These files could be of any file, and must be downloaded as an attachment, rather than displayed in the browser.

    This is the code that I'm using:

    header("Content-type: application/octet-stream");
    header("Content-Disposition: attachment; filename=\"".$download_realfilename."\"");
    header("Content-Length: ".$download_filesize);
    readfile ("http://www.whatever.com/docs/".$download_filename);

    This translates to:
    Content-type: application/octet-stream
    Content-Disposition: attachment; filename="Repton Passwords.txt"
    Content-Length: 70

    File contents, etc.


    Firefox handles this in exactly the way I would expect. IE throws up an error: "Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later."

    What am I doing wrong (obvious MS jokes aside) that Firefox would work and IE would not?

    Source: http://www.livejournal.com/community/php_dev/55077.html

« One Problem || A Good PHP Search Engine? »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home