Are there any web services which will allow me to provide a file extension and it would return a list of possible MIME types?
For example:
http://mimetype.com/getMime/doc
Which could return:
application/msword,application/docappl/text,application/vnd.msword,application/vnd.ms-word,application/winword,application/word,application/x-msw6,application/x-msword
I don't want to use Urlmon.dll and I would prefer not having to keep my own list up-to-date.
Thanks
This webservice could be very simple, a small DB / in memory store which could be as simple as a
Dictionary<String, String>
and just do a key lookup and return the result.The first dataset could be (for example) based on http://www.webmaster-toolkit.com/mime-types.shtml.
The problem would probably be the hosting of such a webservice.
It won't give you the MIME type, but the good olde' Microsoft File Association Web Service could still help you. You access it this way:
where 0409 means English (US) and xls is the file extension. On the plus side, it will be there and constantly updated... well, until Microsoft decides to pull the plug. Which can happen any time.
Though its not exactly what you are asking for, this information is available via search by format in the PRONOM registry. The result is more fine-grained than MIME types, but you can get MIME info if available for the results (e.g. here, in the 'identifiers' section). There is also the DROID tool available to access this information via GUI, Java API or command line interface.
Sorry that I don't have a webservice for the task on hand, but you could use the fileext page and maybe parse the response if you can query the extension programmatically. Maybe a first step in the right direction.
I don't know if there is a web service that would do this, but the libmagic library (http://en.wikipedia.org/wiki/Libmagic) is used for identifying filetypes and might be helpful for you.
I just created this as part of my mimetype <-> icon service
http://stdicon.com/
For example :
http://stdicon.com/ext/html
It runs on appengine so it should have high availability.