I have this problem and had a specification .
How to notice him
unzip . Checking the output file with unzip, I saw a warning in the second line.
$ unzip -l file.xlsx Archive: file.xlsx warning file: 3 extra bytes at beginning or within zipfile ...
xxd (hex viewer) : I saw the first 5 bytes with the following command
head -c5 file.xlsx | xxd -g 1 0000000: ef bb bf 50 4b PK...
Note the first 3 bytes of ef bb bf , which is BOM!
Why?
Maybe a php file with BOM or previous output from the library.
You must find where the file or command with the specification is located. In my case and right now I donβt have time to find it, but I solve it with the help of the output buffer.
<?php ob_start(); // ... code, includes, etc ob_get_clean(); // headers ... readfile($file);
source share