I have forms.Form in django. In this form there is a forms.FileField. This field is rendered in html as
<input id="id_upload-loaded_file" name="upload-loaded_file" type="file">
I need to add accepted files only with ".zip" extension so that form will be rendered as
<input id="id_upload-loaded_file" name="upload-loaded_file" type="file" accept=".zip">
How can I add accepted file extension attribute in django?
This is how I did it:
zip_file = forms.FileField(label='Select zip file', widget=forms.FileInput(attrs={'accept': '.zip'}))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With