import os def file_type(file_path, allowed_extensions=['pdf', 'pptx', 'docx', 'jpeg', 'png', 'jpg', 'webp']): _, extension = os.path.splitext(file_path) extension = extension.lower()[1:] # Remove the dot and convert to lowercase print("?>>>>>>>>>>>>>",extension) if extension in allowed_extensions: return extension # If neither MIME type nor extension match, return None return None