I just came onto a project where a visitor downloads a file after hitting a button. The button goes to a .php file and then uses header functions to initiate the download. The problem is after a server switch, the .exe is file is downloading as filename.php. The download is the file seeing as renaming it to .exe makes it run properly.
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"".$fileName."\"\nContent-length: ".(string)(filesize($fileName)));
header("Content-Description: File Transfer");
if I exit the program to echo out $fileName it shows it as filename.exe correctly yet it's still downloading as the php.