How to recognize different file types