function for identifying file type