Skip to main content
2 of 2
deleted 15 characters in body

In addition to foamcow answer (which is exactly how I do it). Here's some extra fruity code.

  • Add a date to the file name.
  • IE can cause problems.
  • As it's just HTML, use the segment as a 'switch' to output as a page or download file. Handy when building your export.
>    $date = date('Y-m-d_G-i');
>    $export=$IN->fetch_uri_segment('3');
>       
>   if($export)
>   {       
>       if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE"))
>       {
>           header('Content-Type: application/octet-stream');
>           header('Content-Disposition: inline; filename="custom_name_'.$date.'.xls"');
>           header('Expires: 0');
>           header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
>           header('Pragma: public');
>       } 
>       else 
>       {
>           header('Content-Type: application/octet-stream');
>           header('Content-Disposition: attachment; filename="custom_name_'.$date.'.xls"');
>           header('Expires: 0');
>           header('Pragma: no-cache');
>       }
>   }
>?>