K
K
KoRNeT46RuS2017-11-08 11:18:47
PHP
KoRNeT46RuS, 2017-11-08 11:18:47

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');

And without headers, the file will not be uploaded. So is it possible to sequentially upload files generated in PHPExcel?
P.S. I know that you can archive, but is it possible separately?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2017-11-08
@KoRNeT46RuS

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 question

Ask a Question

731 491 924 answers to any question