Well, you have something like this:
use constant FILETYPES => (
mp3 => 'icons/audio-mp3.png',
ogg => 'icons/audio-ogg.png',
swf => 'icons/flash.png',
);
And then you make sure those image files exist in the icons/
directory. The rest should be magic.