Page 1 of 1

Error downloading a file

Posted: Sat Feb 07, 2009 7:54 am
by rvlira
Hey everyone!

I'm dealing with a strange problem here. I created a PHP script to generate a TSV file. The user should be able to download the file.

Here's the PHP code:

Code: Select all

 
<?php
 
  header('Content-Disposition: attachment; filename="report.xls"');
  header("Pragma: no-cache");
  header("Expires: 0");
 
  print "Header1\tHeader2\r\n";
  print "Field1\tField2\r\n";
  print "Field3\tField4\r\n";
  print "Field5\tField6\r\n";
  print "Field7\tField8\r\n";
  print "Field9\tField10\r\n";
 
?> 
 
I tried running this script at home. I get the following error:

Internet Explorer can't download report.xls from XXX.XXX.XXX.XXX.

First I thought it was a script error. Then I uploaded it to a test host and it works. Also I tested it on a friend computer. The script worked again. The difference between my friend and my house's computer is that he installed apache+php through "WAMP Server" and I've installed apache+php manually.

So, I don't think it's a Windows permission problem since no changes has been made at my friends computer. I'm guessing it's a configuration problem.

It would be good to run it without having to install WAMP Server.

Do you have any ideas on that?

Thanks in advance.