Jim Katz - 2010-04-29 20:13:53
I added this method to output my XLS file to the browser:
function output(){
$this->fp = @fopen($this->fileName,"r");
$this->buffer = fread($this->fp,filesize($this->fileName));
header('Content-Type: application/xls');
if(headers_sent())
echo ('Some data has already been output to browser, can\'t send XLS file');
header('Content-Length: '.strlen($this->buffer));
header('Content-disposition: inline; filename="'.$this->fileName.'"');
fclose($this->fp);
unlink($this->fileName);
echo $this->buffer;
}
$this->fileName is assigned in the constructor.
I call $this->output() after the call to fclose in the close method. To clean up the server I call unlink.