because I can not download an excel file in linux

0

I am trying to create and download an excel file in php using the PHPExcel library. The part of creating the file goes well, but when it comes back to download in Linux it does not work for me in Windows works perfectly.

    // We'll be outputting an excel file
    header('Content-type: application/vnd.ms-excel');

    // It will be called file.xls
    header('Content-Disposition: attachment; filename="file.xls"');
    $objWriter = \PHPExcel_IOFactory::createWriter( $objPHPExcel, "Excel2007" );'introducir el código aquí'
    // Write file to the browser
    $objWriter->save('php://output');

In linux I get the following error

    
asked by Alberto Cabrera 11.07.2017 в 21:10
source

1 answer

0

I think you're missing headers:

header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");;
header("Content-Disposition: attachment;filename=$filename");
header("Content-Transfer-Encoding: binary ");
    
answered by 11.07.2017 в 21:45