12 lines
375 B
Python
12 lines
375 B
Python
|
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif'}
|
||
|
|
||
|
|
||
|
def allowed_file(filename):
|
||
|
""" Ensures only filenames ending with the correct extension are allowed.
|
||
|
Note: This does not verify that the content inside of the file
|
||
|
matches the type specified
|
||
|
"""
|
||
|
return '.' in filename and \
|
||
|
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
|
||
|
|