views:

1827

answers:

10

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

Update: I have started a bounty on this question because such a web service would be so useful...

+1  A: 

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.

boutta
+1  A: 

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.

Fabian Steeg
+1  A: 

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.

Davy Landman
This list you mention on webmaster's toolkit, is very very incomplete...
Keltia
@keltia: true, other data sources are already mentioned. I was just explaining that the web service itself would not be a problem, even the data must be online somewhere, its about hosting the webservice somewhere.
Davy Landman
A: 

The only thing that comes to mind is to parse output from http://www.file-extensions.org/

Anton Gogolev
+3  A: 

The only thing I could imagine would be parsing the list which comes with the apache server mime.types. The list is maintained by The Apache Software Foundation and depends on www.iana.org

Peter
A: 

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:

http://shell.windows.com/fileassoc/0409/xml/redir.asp?Ext=xls

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.

DrJokepu
+1  A: 

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.

Rory
A: 

A list of MIME types surely won't change that much?

Mitch Wheat
A: 

Is a web service really more useful than a library? I suppose it could be kept up to date, but otherwise what's the benefit? Do you envisage a lot of use for this?

Calum
+4  A: 

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.

Paul Tarjan