Even if rackspace would tell you the file type, you don't want it to, since it would take so long to run roundtrips from your server to theirs.
My code examples below assume carrierwave, but I'm sure paperclip has similar options. Two options:
- Interpret the file extension
Something like: File.extname(user.avatar)
, which you then have to interpret however you like.
- Record & interpret the mime type.
The carrierwave readme explains how to get carrierwave to calculate it in the first place, and then you should probably store it to your database manually or using carrierwave-meta. Then user.avatar.content_type
would be something like image/jpeg
which you could easily interpret as a particular file type.