File type detection