I've successfully forced a text file to download. Problem is I'm using this file as a CSV to import data into a program and when I force download, it adds a blank line above my data. Any ideas?

Here is the code I'm using:

header("Content-Type: application/text");
header("Content-Disposition: attachment; filename=EnterName.txt");
echo $row_Recordset1['id'],",",$row_Recordset1['stuff'],",",$row_Recordset1['data']; ?>

Any help would be appreciated

    <?php
    header("Content-Type: application/text");
    header("Content-Disposition: attachment; filename=EnterName.txt");
    ob_clean();
    echo $row_Recordset1['id'],",",$row_Recordset1['stuff'],",",$row_Recordset1['data'];
    ?>

    I think that should work

      Thanks. That ob_clean worked great!

        Write a Reply...