Answer the question
In order to leave comments, you need to log in
Problem when downloading the generated Excel file
For formation I use phpExcel. The file is generated and when downloaded from the server via ftp or via a direct link, the file is opened. And if you send it to the client via header(), then the file does not open. Writes "the actual format of the file being opened differs from the file name indicated by its extension." And the file thus has zero size.
Send code:
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="orders.xls"');
header('Cache-Control: max-age=0');
header("Content-Length: " . filesize($_SERVER['DOCUMENT_ROOT'].'/files/orders.xls'));
Answer the question
In order to leave comments, you need to log in
What always surprises me on Habré:
You go to the section created for questions . You create a question after trying to solve it yourself. You write and comment on everything.
All the same, the question is minus, and even they manage to slap a minus into karma ...
Yes, I understand, blunted at first.
The result is the same - zero size and "the actual format of the file being opened differs from the specified one."
I set the rights to the file before uploading to 777.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question