Use mimemagic to detect filetype if the file has no extension

Not sure if this is GTM. 

1. rake fails with 3 errors, not related to this change. 
2. Should I require mimemagic explicitly if it's already in gemfile? Just to be sure. 

What do you think?