jazzband / django-formtools

A set of high-level abstractions for Django forms
https://django-formtools.readthedocs.io
BSD 3-Clause "New" or "Revised" License
797 stars 135 forks source link

FileField not working properly #170

Closed FilipeAVS closed 4 years ago

FilipeAVS commented 4 years ago

Hey all 👋

I'm currently working with the Form Wizard to build a multi-step form. I have 5 steps (hence 5 forms), and on the 4th one I'm trying to add a FileField like this:

attachment = forms.FileField()

Very simple and direct. Also, on my view I added this:

    class FormWizard(SessionWizardView):
        file_storage = FileSystemStorage(location="/media/participation")
        ...

Also nothing too fancy here. For some reason, this is not working. I can select a file on my form and everything, but when I press to go to the next step, the page only refreshes. Like this:

Screen Capture on 2020-08-20 at 18-30-23

I followed the documentation so am I missing something? Thank you.

FilipeAVS commented 4 years ago

I was missing the enctype at the form tag in the template: enctype="multipart/form-data"