mardi 3 octobre 2017

Laravel maatwebsite/excel Corrupted file when download it

I need create a Excel file and download it, but when I downlaoded the file, the file was currupted. I searched about this problem and the answer was, 'a space before the php tag', but i cant find, so i save the file in the public folder and there I can open the file, the error just hapen when I download it.

The code:

  Excel::create('relatorio_chamados', function($excel) use($result){
      $excel->sheet('Relatorio', function($sheet) use($result) {
          $sheet->with($result);
        });
  })->store('xlsx');

Download:

public function download($nome){
return response()->download(public_path()."\\uploads\\".$nome);

}

Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire