Page 1 of 1

[SOLVED]Force Download, can't modify header

Posted: Mon Sep 06, 2004 4:43 pm
by Bain
I am trying to force a download of a .csv file from a form which calls it self. here is the code I am using. Is there no way to modify the header on a page that calls it self? What exactly do I need to do to get this download to go?

Code: Select all

<?php
$file2 = "orders.csv";
       Header ("Content-Type: text/csv");
       Header ("Content-Disposition: attachment; filename=$file2");
       readfile($file);
?>
here is the error message I receive from IE when I try to execute.
Warning: Cannot modify header information - headers already sent by (output started at directoryinfo/stats.php:50) in directoryinfo/stats.php on line 509

Warning: Cannot modify header information - headers already sent by (output started at directoryinfo/stats.php:50) in directoryinfo/stats.php on line 510

Posted: Mon Sep 06, 2004 4:46 pm
by feyd
line 50 of stats.php wrote something to the output.
viewtopic.php?t=1157