Help with Content-Type and Content downloading
Posted: Thu Oct 30, 2003 12:43 pm
Hi folks,
this problem is making me insane, so any help would be appreciated.
What I want to do is send the content of a web page as a downloaded file.
My code (greatly simplified) in file test.php is this:
<?php
header("Pragma: no-cache");
header("Content-Type: text/x-delimtext; charset=iso-8859-1; name=\"myresults.sql\"");
header("Content-disposition: attachment; filename=myresults.sql");
#echo "line one\n";
#echo "line two\n";
#echo "line three\n";
?>
in theory, the downloaded file would contain the text:
line one
line two
line three
and would be named myresults.sql
Instead, what I'm getting is a download box, asking me if I want to download test.php and if I click save or open it it tells me IE was unable to open the file.
I've seen this done with phpbb2, so I know it can be done. but I'm having trouble making it work.
Thanks in advance,
Joat
this problem is making me insane, so any help would be appreciated.
What I want to do is send the content of a web page as a downloaded file.
My code (greatly simplified) in file test.php is this:
<?php
header("Pragma: no-cache");
header("Content-Type: text/x-delimtext; charset=iso-8859-1; name=\"myresults.sql\"");
header("Content-disposition: attachment; filename=myresults.sql");
#echo "line one\n";
#echo "line two\n";
#echo "line three\n";
?>
in theory, the downloaded file would contain the text:
line one
line two
line three
and would be named myresults.sql
Instead, what I'm getting is a download box, asking me if I want to download test.php and if I click save or open it it tells me IE was unable to open the file.
I've seen this done with phpbb2, so I know it can be done. but I'm having trouble making it work.
Thanks in advance,
Joat