detect file type by using file name