You are here

function ViewsDataExportExporterTXT::get_headers in Views data export 7.4

Provide headers to the page when an export file is being downloaded.

Parameters

$filename: The name of the file being downloaded. e.g. export.xls.

Overrides ViewsDataExportExporter::get_headers

File

exporters/views_data_export_exporter_txt.inc, line 51

Class

ViewsDataExportExporterTXT
Exporter for creating TXT files.

Code

function get_headers($filename) {
  $headers = parent::get_headers($filename);
  $extension = 'txt';
  $content_type = 'text/txt';
  $headers['Content-Type'] = $content_type;
  $headers['Content-Disposition'] = "attachment; filename={$filename}.{$extension}";
  return $headers;
}