I am using PHP to pass some information in a text file back to the user which is then used as input for an app. I'm using the method shown in the following snippet to serve the file to the user.
header('Content-type: text/csv');
header('Content-Disposition: attachment; filename=filename.dat');
echo $data;
exit();
I get the save as dialogue fine and the data is present the only problem is that there is a line feed character at the start of the output file which I cant seem to get rid of.
It just so happens that the app that uses the data is sensitive to white space and although it would be easy to fix this, forcing the users to update is not a route I want to go down for various reasons.
Does anyone know what is causing this and more importantly any workarounds.