1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

IE downloads file twice if it's loaded from PHP

Discussion in 'Web Design & Development' started by kbazsi, Jul 11, 2006.

Thread Status:
Not open for further replies.
  1. kbazsi

    kbazsi Thread Starter

    Mar 3, 2006

    I'm using the Spreadsheet_Excel_Writer PEAR package to create excel files from PHP. My problem is that when I choose Open in IE the file is downloaded twice, and it ask me twice to open or save. I checked the code and they send these headers:
    header("Content-type: application/vnd.ms-excel");
    header("Content-Disposition: attachment; filename=\"$filename\"");
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
    header("Pragma: public"); 
    In the past I used these headers to load a file from a database and it worked fine:
    if (isset($_SERVER["HTTPS"])) {
    header("Pragma: ");
    header("Content-length: ".$row['size']);
    header("Content-type: ".$row['type']);
    header("Content-Description: ".$row['name']);
    header("Content-Disposition: attachment; filename=".$row['name']);
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Connection: close");
    I tried to combine them but nothing works.
    Any suggestion?
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/482206

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice