[Django]-Is it possible in django forms to leave Filefield empty?


Yes, it is definitely possible, so check if you have required=False.

Quoting from documentation for django 1.4: “By default, each Field class assumes the value is required, so if you pass an empty value — either None or the empty string (“”) — then clean() will raise a ValidationError exception:” ( https://docs.djangoproject.com/en/1.4/ref/forms/fields/#required )


Given that you are basing your form on a model, what you want is Field.blank – this allows a field to be blank. (Potentially you will also want Field.null too, which allows a blank value to be recorded as null in the database).

x = FileField(..., blank=True, null=True)



myfile = forms.FileField(required=False)

Leave a comment