present file to user in header
Posted: Mon May 16, 2005 3:37 pm
Can anyone tell me what is wrong here?
I want to create a .txt file and then give the user the option of opening it in excel or saving it somewhere.
Here is the code:
What I'm getting is a file with the html output.
I want to create a .txt file and then give the user the option of opening it in excel or saving it somewhere.
Here is the code:
Code: Select all
$temp = tmpfile();
fwrite($temp, $out);//$out is a string containing the file output
header("Content-type: application/msexcel");
header("Content-Disposition: attachment; filename=".$eventname.".txt");
readfile($temp);