I am trying to download file through php.
My script is

PHP Code:
$filename $_GET['file'];
$file "uploads/" $filename;
$file_extension strtolower(substr(strrchr($file,"."),1));        
$file_extension )
"pdf"$ctype="application/pdf"; break;
"zip"$ctype="application/zip"; break;
"doc"$ctype="application/msword"; break;
"xls"$ctype="application/vnd.ms-excel"; break;
"ppt"$ctype="application/vnd.ms-powerpoint"; break;
"gif"$ctype="image/gif"; break;
"png"$ctype="image/png"; break;
"jpg"$ctype="image/jpeg"; break;
"mp3"$ctype="application/iTunes"; break;
header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false); // required for certain browsers 
header("Content-Type: $ctype");
header("Content-Disposition: attachment; filename=\"".basename($file)."\";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($file));

The above script opens the dialog box but
I get a "File Conversion" dialog box with three options "Windows Default", "MS-DOS", and "Other encoding" . "Windows Default" is always set when this dialog comes up.

When I press "Ok" in this dialog, word doc. opens - and the body of the document contains garbage characters before and after the body of the document.

What is wrong with the code?
Please guide me.