[SOLVED]File download doesn't work in Google Chrome
Posted: Fri Aug 06, 2010 2:53 am
I am using the following code to download a file from a my server to my pc. It works on other browsers but no save dialog comes up on google chrome. Just wondering if anyone else has experienced this and has found a solution.
Code: Select all
$fp = fopen("exported-recipes.csv", "a");
fwrite( $fp, $csv_output);
fclose($fp);
$size_file=filesize("exported-recipes.csv");
// We'll be outputting a csv file
header('Content-type: application/UTF-8');
// It will be called exported-recipes.csv
header('Content-Disposition: attachment; filename="exported-recipes.csv"');
//only output the contents of the file
header("Content-Description: Download PHP");
header("Content-Length: $size_file");
// The CSV source is in exported-recipes.csv
readfile('exported-recipes.csv');