umairahmad1789's picture
Update utils.py
1de7505 verified
raw
history blame contribute delete
424 Bytes
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