Copy link to clipboard
Copied
Hi all,
I have a data set and want to save as CSV download...
Basically it's working however my mac is not recognizing the /n (new lines)
Did I script this wrong?
Any ideas how to get this working on a mac?
Also when I look at the download file I do not see any line feed or chr(13) return characters....
foreach ($records as $record) {
$alldata .= $record['id'] . "," .$record['Name'] . "," .$record['Info'] . "\n";
}
$response = "data:text/csv;charset=utf-8,id,Name,Info\n";
$response .= $alldata;
echo '<a href="'.$response.'" download="test.csv">download</a>';
Copy link to clipboard
Copied
looks like these headers are getting it working..... so disregard for now
Thanks
$filename = "test1.csv";
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="' . $filename . '";');
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more