[Django]-Django forms: "This field is required" when file POSTed to file field

75👍

Make sure that your form has the enctype set, e.g.:

<form method="post" enctype="multipart/form-data">

From the docs:

Note that request.FILES will only contain data if the request method was POST and the <form> that posted the request has the attribute enctype=”multipart/form-data”. Otherwise, request.FILES will be empty.

Leave a comment