File size: 424 Bytes
cc83df3
 
f4c556f
cc83df3
 
 
1de7505
cc83df3
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
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