Reputation: 19909
Basically, the user will be exporting some data to a txt file. That txt file will then download automatically. The download is working fine and is showing the data I want it to. However, the HTML of the actual page is getting appended onto the end of it?
$fh = fopen($filename, 'w');
fwrite($fh, $data);
fclose($fh);
header('Content-disposition: attachment; filename='.$filename);
header('Content-type: text/plain');
readfile($filename);
Upvotes: 0
Views: 2037
Reputation: 6441
If there is html after the code above, you may want to exit
after readfile($filename)
?
Upvotes: 3