From acc60b38d3834ad9ba35b919f62ead9d84447e90 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Mon, 13 Dec 2010 15:39:42 +0800 Subject: [PATCH] GnumericToExcel.php --- GnumericToExcel.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/GnumericToExcel.php b/GnumericToExcel.php index f53c8bcf..76c3ac31 100644 --- a/GnumericToExcel.php +++ b/GnumericToExcel.php @@ -93,10 +93,16 @@ class Pman_Core_GnumericToExcel extends Pman header('Content-type: application/vnd.ms-excel'); header('Content-Disposition: attachment; filename="' .addslashes($fname). '"'); - header('Content-length: '. filesize($targetTmp)); - $fh = fopen($targetTmp, 'r'); - // will not work on IE... - needs while/fget.. - fpassthru($fh); + header('Content-length: '. filesize($targetTmp)); + header("Content-Transfer-Encoding: binary"); + if ($file = fopen($targetTmp, 'rb')) { + while(!feof($file) and (connection_status()==0)) { + print(fread($file, 1024*8)); + flush(); + } + fclose($file); + } + unlink($targetTmp); exit; -- 2.39.2