NYCPHP Meetup

NYPHP.org

[nycphp-talk] Downloading a CSV file

drydell at att.net drydell at att.net
Wed Sep 8 00:07:50 EDT 2004


>> Here's some pseudo code to get you started. It should prompt the user

this is exactly the technique I use, with one minor difference... just in case the browser has a mime handler for the mime type I'm generating, I use application/force-download to make sure the user always gets the save dialog box:


header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Cache-control: private");
header("Pragma: no-cache");
header("Content-Type: application/force-download");
header('Content-Length: '.strlen($Buffer) );
header('Content-Disposition: attachment; filename="'.$filename.'"');
echo $Buffer;



More information about the talk mailing list