So the process that I have goes like this. A user can pick a date range to view the data that he wants/needs. A Download is then available if he wants to download the file.
When doing a wide range the page throws off a connection error.
Firefox - The connection was reset
Chrome - No Data Received
The code that I use to generate the CSV is
<?php
$res = // the array generated by a mysql query
$text=strtotime("Now");
$filesave=fopen('Downloads/CallLogs'.$text.'.csv','w');
foreach ($res as $display)
{
fputcsv($filesave,$display);
}
//Force download the file. you can correct me if this is the improper way of doing it :)
header('Content-Type: application/download');
header('Content-Disposition: attachment; filename="CallLogs'.$text.'.csv"');
$fp = fopen("Downloads/CallLogs".$text.".csv", "r");
fpassthru($fp);
fclose($fp);
?>
Thanks in advance...