1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| public function excelAction(){
$idxls = $this->getRequest ()->getParam('id');
echo $idxls;
$ct = new Application_Model_DbTable_Shift();
$xls = $ct->find($idxls)->current();
$xls2= $xls->name;
$xls3= $xls->size;
$xls4= $xls->created;
//echo $xls2;
$xlsPath = realpath(APPLICATION_PATH . '/../public/excelshift') .'$xls2' ;
echo $xlsPath;
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$this->getResponse()->setRawHeader( "Content-type: application/msexcel ")
->setRawHeader( "Content-Disposition: attachment; filename =\"$xls2\" " )
->setRawheader("Cache-Control: max-age=0");
// ->setRawheader("Content-Type: application/download")
->setRawHeader( "Cache-Control: must-revalidate, post-check=0, pre-check=0" )
->setRawHeader( "Pragma: public" )
->setRawHeader( "Accept-Ranges: bytes" )
->setRawHeader( "Content-Length: " .$xls3 )
->sendResponse();
readfile( $xlsPath );
exit(); |
Partager