Set html `accept` attribute for file input form when `FileAllowed` is set for file upload
PeterDaveHello opened this issue · 3 comments
PeterDaveHello commented
Currently, the generated html for file doesn't seem to use html "accept" attribute, which will be helpful to guide the users to select the proper files(at least with the correct file extension).
As there is FileAllowed
to set the allowed file extensions, maybe it'll be also great to set it on the form?
azmeuk commented
You can pass accept
in the render_kw
parameter:
photo = FileField("Photo", render_kw={"accept": "image/*"})
PeterDaveHello commented
Thanks @azmeuk , I'll try it before it's supported to be set with FileAllowed!
PeterDaveHello commented
@azmeuk Is that clear that to support some config to set at one place and apply to both front-end and back-end will not be considered? Thanks!