Recall & Review
beginner
What Flask function is commonly used to send files for download?
The
send_file() function is used in Flask to send files to the client, enabling file downloads.Click to reveal answer
beginner
How do you specify the filename that the user will see when downloading a file in Flask?
You use the
download_name parameter in send_file() to set the filename shown to the user.Click to reveal answer
beginner
What parameter in
send_file() forces the browser to download the file instead of displaying it?Setting
as_attachment=True in send_file() tells the browser to download the file as an attachment.Click to reveal answer
intermediate
Why is it important to set the correct MIME type when sending a file in Flask?
The MIME type tells the browser what kind of file it is. Setting it correctly helps the browser handle or display the file properly.
Click to reveal answer
intermediate
How can you send a file stored in memory (like a BytesIO object) for download in Flask?
You can pass the in-memory file object directly to
send_file() along with as_attachment=True and a download_name.Click to reveal answer
Which Flask function is used to send a file to the client for download?
✗ Incorrect
The correct function to send files in Flask is
send_file().What parameter do you set to
True in send_file() to force a file download?✗ Incorrect
Setting
as_attachment=True forces the browser to download the file.How do you specify the filename the user sees when downloading a file in Flask?
✗ Incorrect
The
download_name parameter sets the filename shown to the user.If you want to send a PDF file for download, which MIME type should you set?
✗ Incorrect
The correct MIME type for PDF files is
application/pdf.Can you use
send_file() to send a file stored in memory (like BytesIO)?✗ Incorrect
You can pass an in-memory file object like BytesIO directly to
send_file().Explain how to send a file for download in Flask including setting the filename and forcing download.
Think about the parameters in send_file() that control download behavior.
You got /3 concepts.
Describe why setting the correct MIME type is important when sending files in Flask.
Consider how browsers decide what to do with received files.
You got /3 concepts.