I have one xlsb. (ms excel 2007) file created.
I have uploaded it to server and user of website can download it but when user download and open this file ms excel prompted with error as “Excel found unreadable content” when they click on yes everything is ok. I don’t know why this error displayed.
Then I have sent this xlsb file from gmail and yahoomail and when download and open everything is ok and no any error message.
so please help me to rectify this error. I am using php as my server side language and download code is below
header('Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
//header('Content-type: application/octet-stream');
//header('Content-type: application/vnd.ms-excel.sheet.binary.macroEnabled.12');
header('Content-Disposition: attachment; filename="credit-card-payoff.xlsb"');
readfile('exporting/excel/credit-card-payoff.xlsb');
I have tried different content-type but didn’t success.
below is webpage from user can download excel
http://utc.impexdirectory.com/credit-card-payoff-calculator.php
I have checked the file you provided and can tell you definitely what the error is: Somehow the current website gets appended to this binary-file as well. (If I cutoff the HTML part the file opens without the repair dialogue).
So my best guess for this is, you forgot the
exitstatement after readfile.Your code should read like this:
This prevents that the website gets appended to the download file.