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

  • Home
  • SEARCH
  • 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 have used a code to download file it works well in IE7,, but
I searched for unzipping the .zip file which is downloaded in the document directory.
I am using PHP's ZipArchive class to create a zip file containing photos and
I am working on a website that has incorporated the jquery cycle plugin. It
In this thread we learn how to associate MIME types and file suffixes with
I am using CGI.pm version 3.10 for file upload using Perl. I have a
I have used HTTRACK to download Federal regulations from a government website, and the
I have a J2EE webapp which is used to download a generated PDF served
Suggestion in either in C# or VB.NET is acceptable. I have a class to
I've been fighting with this for a few days now and it looks like

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.