Files Types for Uploading Office Documents

I wanted to have an “allowed” list of file types for uploading, but upon looking at just a few different files on my own computer I see each one is completely different.

  1. vnd.openxmlformats-officedocument.wordprocessingml.document
  2. application/
  3. vnd.openxmlformats-officedocument.spreadsheetml.sheet
  4. application/octet-stream
  5. application/msword

The first four are excel documents, and I only tried four excel documents so I’m worried there may be a bunch of others. If I knew “vnd.openexcelformats”, “” and “octet-stream” were the only formats then it wouldn’t be a problem. I doubt it though. Any ideas what all the possible types are for all office documents? Word, Access, etc.

Here is a list of the newer microsoft office mime types:

You could also just check against file extension.

Always be careful with that, as it’s a pretty easy attack vector. MIME sniffing also isn’t problem free, but better than extension checking IMHO.