2π
β
2 things are necessary for your system to work:
-
The tag has an enctype attribute allowing file uploads, e.g.
<form enctype="multipart/form-data" method="post" action="">
, or the browser will not send the file -
The form is instanciated with both request.POST and request.FILES, e.g.
form = form_class(request.POST, request.FILES)
. Else the FileField will not have any value.
So really whatβs missing from your topic are:
-
The form HTML and
-
The view python code, hint: make sure you inspect request.FILES there BTW
For me to make a perhaps more specific answer.
π€jpic
Source:stackexchange.com