Skip to main content
deleted 15 characters in body
Source Link

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.
>    fetch_uri_segment$date = date('3''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');
     >       }
     >   }
    >?>

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.
    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');
            }
        }
    ?>

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');
>       }
>   }
>?>
Source Link

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.
    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');
            }
        }
    ?>