I have tried this code and it’s working for me.
$filename = “file_example_XLSX_10.xlsx”;
$filepath = “file_example_XLSX_10.xlsx”;
header ( “Pragma: public” );
header ( “Expires: 0” );
header ( “Cache-Control: must-revalidate, post-check=0, pre-check=0” );
header ( “Cache-Control: public” );
header ( “Content-Description: File Transfer” );
header ( “Content-type: application/zip” );
header ( “Content-Disposition: attachment; filename=”" . $filename . “”" );
header ( “Content-Transfer-Encoding: binary” );
header ( "Content-Length: " . filesize ( $filepath ) );
ob_end_flush ();
@readfile ( $filepath );
Note: Please palce your downloadable file in webroot folder.