Unable to download file in Internet Explorer 8

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 domain.com.

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!
Who is Participating?
Ray PaseurConnect With a Mentor Commented:
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
Sudaraka WijesingheConnect With a Mentor Web Application ProgrammerCommented:
Have you tried application/force-download instead of application/octet-stream?
James MurrellProduct SpecialistCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.