From the course: Flask Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

File uploads from users

File uploads from users

From the course: Flask Essential Training

Start my 1-month free trial

File uploads from users

- [Narrator] Our URL shortener right now allows people to provide a short name for a URL that they want to get to quickly. But remember, our URL shortener not only takes URLs, but also can take files for users that they can then upload, and have a short name to get to quickly. So in order to accept files, we have to add a new form to our home page to be able to accept that. So let's go ahead and move back to our home dot html. And we want to create a form very similar to the one that we have. So let's go ahead and copy that, and down below paste, and now there's a few changes we're going to have to make to this second form. So in the top form tag here on our second form, we're going to add an extra field here called enctype, and make sure that it's set to multi-part slash form data. Essentially what this says is that this form is allowed to have file uploads. Next we're going to change this from website URL to simply…

Contents