From the course: Django: Forms

Unlock the full course today

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

Forms and files

Forms and files

From the course: Django: Forms

Start my 1-month free trial

Forms and files

- A very great feature of forms that we have not discussed yet is the ability to take files that the user wants to upload to us, whether it's going to be images or some sort of CSV data. Whatever it is, we can accept that into our project via forms. If you're going to accept some sort of file, there's a few different pieces that we have to make sure are ready to accept it. The first one is, we have to move to our order.html. In our form, we have to specify that it's going to be able to take this type of information. In our form here, we'll just do it right before the action, we'll say enctype =, and then we're going to have this be equal to, and look we already have the suggestion here, we want multipart/form-data, meaning that the user should be able to select some sort of file and add it to the following form. We've got to make that change, we'll go ahead and hit Command + S, save that. Then, if we're going to be accepting images into our project, we're going to have to move over…

Contents