Unable to download file in Internet Explorer 8

Posted on 2011-04-29
Last Modified: 2013-11-19
Hi Experts,

I'm trying to start the download of a PDF file in Symfony. It works well using Firefox, Chrome, Opera, etc., but when I use Internet Explorer (7 + 8), I got the following error:
Unable to download file.pdf from

Unable to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.

Open in new window

Needless to say, the website works everywhere else.

Here is the action in Symfony:
public function executeIndex(sfWebRequest $request)
    $filename = '/path/to/file.pdf';
    $response = $this->getResponse();
    $response->addCacheControlHttpHeader('private, must-revalidate, post-check=0, pre-check=0');
    $response->setContentType('application/octet-stream', true);
    $response->setHttpHeader('Content-Transfer-Encoding', 'binary', true);
    $response->setHttpHeader('Content-Disposition', 'attachment; filename=' . $filename, true);
    $response->setHttpHeader('Content-Length', filesize($filename), true);
    $response->setHttpHeader('Last-Modified', gmstrftime("%a, %d %b %Y %H:%M:%S GMT", filemtime($filename)), true);
    return sfView::NONE;

Open in new window

I believe it's some header issue, but I've tried to enable/disable/switch them, without success.

Thank you for your help!
Question by:ChoobsTech
    LVL 18

    Assisted Solution

    by:Sudaraka Wijesinghe
    Have you tried application/force-download instead of application/octet-stream?
    LVL 107

    Accepted Solution

    One slight change in the design might overcome the problem in all browsers... Instead of trying to start the download, just write the PDF to a file on the server file system and give the client a link to start the download at the client's convenience.  Say something like, "Click here to download the PDF."  Most browsers are smart enough to tell the client if the PDF plug-in is missing.  HTH, ~Ray
    LVL 31

    Expert Comment

    by:James Murrell
    This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
    Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now