Mapping File Extensions to MIME Types

When writing Salsa (an Amazon S3 client), I ran into a situation where I needed to map MIME types to file extensions and vice versa. So I wrote a simple but very handy utility to do it for me. The ActionScript code is here if you just want to copy it, or it’s available in as3corelib if you want grab the entire library (with tons of other useful APIs).

One Response to Mapping File Extensions to MIME Types

  1. spugbrap says:

    Thanks, Christian! I do remember needing something like this, on more than one occasion. I never found such a conveniently packaged lookup mechanism, though.I think last time I thought I needed this functionality, I ended up rethinking my application/module’s design, and was able to eliminate the need for MIMEextension mapping.But, I know that’s not always possible. So, I am saving this code, because it will probably come in handy someday!