Answer the question
In order to leave comments, you need to log in
How to give several generated excel at a time?
Let's say I have sequentially called functions in which a file is generated, then given to the user. But the problem is that in the very first function of generating a file to return the file to the user, headers are formed and given. At this point, the handler stops working and does not go any further. In fact, only the first file is loaded.
// set headers
header('Content-type: application/vnd.ms-excel');
$filename = 'filename.xls';
header('Content-Disposition: attachment; filename="'.$filename.'"');
// send file content
$writer = \PHPExcel_IOFactory::createWriter($excel, 'Excel5');
$writer->save('php://output');
Answer the question
In order to leave comments, you need to log in
The HTTP protocol does not support uploading multiple files in response to a single request. You need to either give one archive, or initiate several requests from the client.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question