$dump->start($fullPathName); // all credits: http://stackoverflow.com/q/22046020/2790481 header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=\"" . basename($zippedFileName) . "\";"); header("Content-Type: application/octet-stream"); header("Content-Encoding: binary"); header("Content-Length: " . filesize($filePath . $zippedFileName)); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private"); header("Pragma: public"); ob_clean(); readfile($filePath . $zippedFileName); } else { if (isBtnRqstDownloadExcelKeyPrsd()) { Excel::downloadAppointments($_POST['termId']); exit; } } } } } } } } catch (Exception $e) { $errors[] = $e->getMessage(); } /** * @return bool */ function isBtnRqstDropboxConnectionPrsd()