Uploading Files with Flask - Everything You Need to Know

Sdílet
Vložit
  • čas přidán 29. 07. 2024
  • FULL STACK COURSE (React, Flask, & PostgreSQL): lukepeters.me/build-a-full-st...
    In this video you'll learn how to upload files using Flask, how to limit file uploads to images only, how to set a maximum upload file size, and how to serve and display uploaded images in a Flask template.
    0:00 - Project setup
    0:59 - Build the HTML form
    2:07 - Create the upload route in Flask
    6:10 - Make filenames more secure
    8:17 - Make sure a file is selected before uploading
    9:16 - Use os.path.join() to improve the code
    10:24 - Create app config variables
    11:18 - Limit the maximum upload file size
    14:18 - Only allow images to be uploaded
    17:18 - Display uploaded images in the template
    24:35 - Ideas for future improvements
    ---------------------------------------------------------------
    PROJECT CODE (STYLES.CSS INCLUDED)
    github.com/LukePeters/flask-f...
    ---------------------------------------------------------------
    RECOMMENDED WEB HOSTING
    I swear by Linode. I've been using them for years and I refer every freelance client to them. Here's my special referral link if you want to help me out a little: lukepeters.tech/linode
    ---------------------------------------------------------------
    MY DESK SETUP GEAR (affiliate links)
    ⌨️ Keyboard - amzn.to/3sR3WEK
    🖱 Mouse - amzn.to/3aEBvnc
    🖥 Monitor - amzn.to/30pmuzd
    🦾 Monitor Mount/Arm - amzn.to/3sLd3Xu
    🎤 Microphone - amzn.to/3sRfxUb
    🦾 Microphone Arm - amzn.to/3xrxImT
    🎛 Microphone Processor - amzn.to/3gConme
    ⚡️ Thunderbolt Dock - amzn.to/3aE8aJC
    🔊 Speakers - amzn.to/3nip0D0
    🎧 Headphones - amzn.to/3xoCVfm
    🪑 Chair - amzn.to/3eBIw9I
  • Věda a technologie

Komentáře • 47