Check file extension first, then mime