Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1001179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:37:42+00:00 2026-05-16T07:37:42+00:00

My file download as document is not working in IE. How can I write

  • 0

My file download as document is not working in IE. How can I write code in PHP to download the file correctly in Internet Explorer

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T07:37:43+00:00Added an answer on May 16, 2026 at 7:37 am

    The following is the code i have been using for the past three years and it is working fine.
    Just now i tested in all browsers IE6, IE7, IE8 and in all those it is working fine.
    The $fn is the full path of the file.
    and make sure that no other extra spaces or newlines are there anyway i have used ob_clean before flushing the file to the browser.

    Better if you have no other html code sent above this… so use it seperately with no other content. else start the code with ob_start(); so at the line of ob_clean() there wont be any extra chars.

    $filename = "$fn";
    ob_clean();
    header("Cache-Control: no-store");
    header("Expires: 0");
    header("Content-Type: application/octet-stream");
    header("Content-disposition: attachment; filename=\"".basename($filename)."\"");
    header("Content-Transfer-Encoding: binary");
    header('Content-Length: '. filesize($filename));
    readfile($filename);
    

    I have a file management module where i upload files and the user can download it.
    If you still have issues or unable to make it work the just add few more lines of your problem and the people who ever sees would respond to that.

    THE REASON I HAVE USED SOME MORE HEADERS IS TO MAKE SURE THAT IT WORKS BECAUSE INITIALLY I HAD PROBLEMS WITH IE 6.

    for secure servers HTTPS replace the first two headers with this one.

    header("Cache-Control:  maxage=1");
    header("Pragma: public");
    

    this way it is working for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i wrote code to download jquery file from google CDN first and if not
When user requests to download a document, I'm writing out a PDF file to
i download a kml file : <?xml version=1.0 encoding=UTF-8?> <kml xmlns=http://www.opengis.net/kml/2.2> <Document> <Style id=transGreenPoly>
I created a file download script in PHP, it works, but web browsers report
I have a file download code in my site which worked perfectly fine untill
I am working in iPhone application, I have download a file from Dropbox to
I want to make install file in Fedora. (Download files from Internet and save
I posted on IE 9 not accepting SendKeys to download a file , but
Currently to have to user download a file I have the following javascript. document.location.href
I am trying to download the file from the document using sharepoint webservices called

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.