[thelist] Header Problems with file downloads

Anthony Baratta Anthony at Baratta.com
Thu Mar 11 16:34:36 CST 2004


At 11:23 AM 3/11/2004, The Lists wrote:

>file_put_contents_php4("data.csv", $output);
># creates csv file and outputs it to data.csv
>
>header("Content-type: application/csv;");
>header("Content-disposition: attachment; filename=data.csv");
>
>But when I open the csv file it is just the current web page and NOT the 
>csv file in question...I presume it is the headers which are wrong..any 
>suggestions please?

You need to open the file and stream it to the browser. The above header 
information is for information purposes to the browser. It will not 
physically send the file. You need to do that "manually".



More information about the thelist mailing list