She Fu
She Fu

Reputation: 271

Laravel (5.2) Excel download xls error ERR_INVALID_RESPONSE (chrome)

I can't download/export in xls or xlsx , only in csv format

$data = Orders::get();
$xls = Excel::create('Orders', function($excel) use($data) {

          $excel->sheet('orders', function($sheet) use($data) {

              $sheet->fromArray($data);

          });

      })->download('xls');
return redirect()->back();

I tried to ob_clean in the laravelexcelwriter.php on method _download(line 317) , above the save function(line 341), no result. Also in the save function(line 341) I tried similar options for I/O streams (default is php://output) like php://stdout, php://stderr, php://fd, php://memory and still no result.

is this a php.ini problem? a server problem ? where should I check ?

Upvotes: 2

Views: 3062

Answers (2)

Perfect
Perfect

Reputation: 1636

I think you got the error on Google Chrome Browser, which is the same error as I made. Have you installed php ziparchive module? Please try to install that. If you are in php 7, then following might help you.

sudo apt-get install php7.0-zip

Thanks

Upvotes: 2

piscator
piscator

Reputation: 8719

Editing the time limit and memory limit fixed it for me. Try what happens if you put this before the Excel::create() method:

set_time_limit(0);
ini_set('memory_limit', '1G');

Upvotes: 0

Related Questions