I download files from server but excel or word files are corrupted after download. Pdfs, jpgs etc. are ok.
ob_clean();
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: ").$att->getType();
header("Content-Disposition: attachment; filename=" . basename($att->getName()));
header("Content-Transfer-Encoding: binary");
header("Content-Description: File Transfer");
readfile($path);
Content type for excel I have - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet