나는 엑셀 파일을 다운로드 할 수 있습니다. 예를 들어 NAME.xlsx는 파이어 폭스에서도 작동하지만 webkit (safari/chrome)에서는 이름에 확장자를 추가합니다 .xhtml 그래서 다음은 을해야 NAME.xlsx.html이 될 것입니다 이름 만 여기에 당신이 내 헤더가 .XLSX웹킷 및 엑셀 파일 (PHPexcel)
:
$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
$objWriter->save($root.'/application/to_excel/KSW.xlsx');
$this->getResponse()->setHeader('Content-type', 'application/download', true);
$this->getResponse()->setHeader('Content-type', 'application/octet-stream', true);
$this->getResponse()->setHeader('Content-type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', true);
$this->getResponse()->setHeader('Content-disposition', 'attachment;filename='.basename($root.'/application/to_excel/KSW.xlsx').'', true);
$this->getResponse()->setHeader('Cache-Control', 'max-age=0', true);
그래서 내가 잘못하고있어 무엇을?
왜 'content-type'을 세 번 설정 했습니까? '옥텟 스트림'을 하나만 사용해 볼 수 있습니까? –
이제는 이름 (1) .html..xhtml이 추가됩니다. – Uffo