Forced download with php

Hey, I got this script for previous posts here on Kirupa:
PHP Code

<?php 
$filename = $_GET['filename']; 
if (ereg(".mp3$", $filename)) { 
header("Pragma: public"); 
header("Expires: 0"); 
header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 
header("Content-Type: application/force-download"); 
header("Content-Type: application/octet-stream"); 
header("Content-Type: application/download"); 
header("Content-Disposition: attachment; filename=".basename($filename).";"); 
header("Content-Transfer-Encoding: binary"); 
header("Content-Length: ".filesize($filename)); 
readfile("$filename"); 
} 
?> 

Flash Code

getURL("folder/filedownload.php?filename=someMP3.mp3", "_blank", "GET");

How can I use this code to also force download other filetypes, like mp3, wma, avi, rar, zip etc etc…?

Is it any way I just could add the filetype names in the script? Maybe in this part: “if (ereg(”.mp3$", $filename)) {" ???

And how can I get the flash code to be used in the url field in a dynamic textfield? Atm it uses getURL and the has to be used on a button?

If I make any sense, please reply.

Thanks,
fatnslow