Consolidated file type check for both client and server side

![screen shot 2014-09-11 at 8 33 09 pm](https://cloud.githubusercontent.com/assets/5281068/4245074/d2ccae3c-3a2d-11e4-83c6-4489df07ae31.png)