We're trying to send uploaded attachements (served from a database as blob) through php with Zend Framework to a client.
This code works fine for Excel97 / Word97.
if ($this->getResponse()->canSendHeaders(false)) {
$response = $this->getResponse();
$response->setHeader('Pragma', 'public', true)
->setHeader('Expires', '0', true)
->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)
->setHeader('Content-Type', 'application/force-download', true)
->setHeader('Content-Type', 'application/octet-stream', true)
->setHeader('Content-Type', 'application/download', true)
->setHeader('Content-Disposition', "attachment;filename=$filename", true)
->setHeader('Content-Transfer-Encoding', 'binary', true)
->setBody($data) // binary
->sendHeaders();
}
But is not working for excel2007 / word2007. It reports "file has an error" and trys to fix it.
Any suggestions?