Unable to download a file with example script

Topics: Developer Forum
Jul 10, 2014 at 10:37 AM
Edited Jul 10, 2014 at 1:28 PM
I want to create xlsx file and send to the browser as an attachment, so the user downloads it immediately. I literally did copy-paste the code from this example. But it doesn't work. I fixed the path in require_once, but the issue is somewhere else.
The xlsx file is generated corerctly - when I save ot on the server, I can open it. It is also sent to the browser - firebug's console shows some funny characters in output window. The headers are also correct.

But no Save as... dialog is shown. I did some basic checks based on google search results - I have no extra white space after ?>. The only difference in my code is that I call php script from jQuery's $.post function with some additional arguments. Could it be the reason why I can't download this file?

Any help would be greatly appreciated!

PHP version: 5.4.20
PHPExcel version: 1.8.0
Server: Apache/2.4.6 (Linux/SUSE)
Jul 11, 2014 at 11:28 AM
I found an answer here.
Marked as answer by maialithar on 7/11/2014 at 3:28 AM