I have uploading working just fine, but the problem is, I would like to filter out all file types that are not needed.
I know with html, you can use something like:
<input type="file" name="file" accept="image/*" id="file"> <input type="submit" name="submit" value="Upload Image!">
and in this case, this tells the browser to only show image files in the file dialog box.
I can’t figure out how I can add the accept=”image/*” to Django’s widget.
Any help is most welcomed!
You can change this with the widget
attrsas documented here: https://docs.djangoproject.com/en/1.3/ref/forms/widgets/#django.forms.Widget.attrsOr you can use something like django-widget-tweaks to do this with a templatetag.