Hi, first post here
Been learning CI for a few days now and I find it very nice
Here is a problem I'm struggling with. I have an Excel file located at $file_name. I want to send it for download to the browser. I'm using the following :
PHP Code:
// Echo done
echo date('H:i:s') . " Done writing file.\r\n";
$this->load->library('zip');
$this->zip->add_data('excel_results.xls', file_get_contents($file_name));
$this->zip->archive('my_backup.zip');
$this->zip->download('my_backup.zip');
When I run this script, the file is not sent to the browser for download, but instead, it is output on the page:
... and I just found the problem
. But since it's my first post in here, I'm going to publish it anyway as it might help someone else
So the problem is that I was echoing some code prior. This screwed the headers. I removed the echo, and now it's working perfectly.