We help IT Professionals succeed at work.

Unable to download file in Internet Explorer 8

Medium Priority
841 Views
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 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->clearHttpHeaders();
    $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);
    $response->sendHttpHeaders();
    readfile($filename);
    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!
Comment
Watch Question

Sudaraka WijesingheWeb Application Programmer
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Most Valuable Expert 2011
Author of the Year 2014
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
James MurrellQA Product Specialist
CERTIFIED EXPERT

Commented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.