Complete the code to import the Flask class.
from flask import [1]
The Flask class is imported from the flask module to create the app.
Complete the code to get the uploaded file from the request.
file = request.files.get('[1]')
The key used to get the uploaded file from request.files should match the form input name, commonly 'file'.
Fix the error in saving the uploaded file securely.
filename = [1](file.filename)
file.save(filename)Use secure_filename from werkzeug.utils to avoid unsafe file names.
Fill both blanks to check if the file is allowed and save it.
if file and '[1]' in file.filename and file.filename.rsplit('.', 1)[1].lower() [2] ALLOWED_EXTENSIONS: filename = secure_filename(file.filename) file.save(filename)
Check if filename contains a dot and if the extension is in allowed extensions.
Fill all three blanks to create a dictionary of filenames and their sizes for allowed files.
files_info = {file.filename: [1] for file in files if '.' in file.filename and file.filename.rsplit('.', 1)[1].lower() [2] ALLOWED_EXTENSIONS and file [3] None}We read the file content length, check extension membership, and ensure file is not None.
