You are here

function results_export_invoke_file_transfer in Quiz 6.6

Same name and namespace in other branches
  1. 6.5 includes/results_export/results_export.admin.inc \results_export_invoke_file_transfer()
2 calls to results_export_invoke_file_transfer()
results_export_as_full_view in includes/results_export/results_export.admin.inc
results_export_as_teaser_view in includes/results_export/results_export.admin.inc

File

includes/results_export/results_export.admin.inc, line 25

Code

function results_export_invoke_file_transfer($filename, $output) {
  ob_start();
  $filepath = file_directory_temp() . '/' . $filename;
  $handle = @fopen($filepath, 'w');
  fwrite($handle, $output);
  fclose($handle);
  $headers = array(
    'Content-Type: text/html',
    'Content-Disposition: attachment; filename=' . $filename,
  );
  ob_clean();
  file_transfer($filepath, $headers);
  ob_end_clean();
}