Különböző formátumok fájlok letöltése "sima" klikkre

Ez egy szöveges fájl. A szülő DIV-be include-olva van...
<?php
$filename = !empty($_POST["fajl"]) ? $_POST["fajl"] : "kepek/error.png";
$filename = trim( $filename );
if( substr($filename, 0, 1) == '.' || substr($filename, 0, 1) == '/' )
{
  header("Location:klikkletolt.php");
  exit();
}
$filename = realpath($filename);
//ha a fájl létezik
if (file_exists($filename))
{
  $file_extension = strtolower(substr(strrchr($filename,"."),1));
  switch ($file_extension)
  {
    case "jpg": $ctype="image/jpg";
      break;
    case "jpeg": $ctype="image/jpeg";
      break;
    case "png": $ctype="image/png";
      break;
    case "gif": $ctype="image/gif";
      break;
    case "txt": $ctype="text/plain";
      break;
    case "php": $ctype="text/html";
      break;
    case "mp4": $ctype="video/mp4";
      break;
    case "mp3": $ctype="audio/mpeg";
      break;
    case "pdf": $ctype="application/pdf";
      break;
    case "xls": $ctype="application/vnd.ms-excel";
      break;
  }
  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: $ctype");
  header("Content-Disposition: attachment; filename=\"".basename($filename)."\";");
  header("Content-Transfer-Encoding: binary");
  header("Content-Length: ".@filesize($filename));
  @readfile($filename);
}
?>