HTTP header CSV type

The right HTTP header content-type for CSV files is the following:


The complete HTTP header:

Content-Type: text/csv

In PHP you should use for an CSV file download the following lines at the start of the file:

header("Content-Type: text/csv");
// after this line you output the content of the csv file

In C#/ASP .Net you use the following code in the code behind file:

this.Response.ContentType = "text/csv";


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.