title: How do I get csv file to download on IE? Works on firefox
body: <p>I'm struggling with an odd error. I have a simple web app that grabs stuff from a DB then outputs it as a downloadable csv file. It works on firefox and chrome, but IE fails to recognize it as a csv file (thinking it is a html fle) and when I click save I get the error, "Unable to download {name of file} from {name of site}. Unable to open this internet site. ..."</p>
  
  <p>Code: </p>
  
  <pre><code>session_start();
  
  //some logic goes here...  
  
  //generate csv header  
  header("Content-type: application/octet-stream");  
  header("Content-Disposition: attachment; filename=exportevent.csv");  
  header("Pragma: no-cache");  
  header("Expires: 0");  
  
  echo "Event: " . $event_title . "\n";  
  
  //print the column names  
  echo "Last Name, First Name, Company \n";  
  
  while($row = mysql_fetch_assoc($result))  
  {  
      echo $row['atlname'] . ',' . $row['atfname'] . ',' . $row['atcompany'] . "\n";      
  }
  </code></pre>
  
  <p>I've played around with the content-type a whole bunch, but that had no effect.</p>
  
  <p>Update: I've tried text/csv, application/vnd.ms-excel (and variations of this), text/plain, and some others that I now forget with no luck.</p>
  
  <p>This is IE8 btw.</p>
  
  <p>Update 2: The connection is over SSL.</p>