I have default csv template. I need to show this template when user click on a specific button.
The code is here
$filePath = $_SERVER['DOCUMENT_ROOT']."/content/formatted_blank.csv";
$csvfile = file_get_contents($filePath);
$filename = "formatted_blank.csv";
echo $csvfile;
header("Content-type: application/csv");
header("Content-Disposition: attachment; filename=\"".$filename."\"");
die();
The code is working fine. But the output file is not matching my default template. In default template i wrote header in 1 row But download file showing in 7th row. There is white space rows coming.
if any one know about this please help me.