Benjamin RD
Benjamin RD

Reputation: 12044

limit selectable files by extensions rails and haml

I'm using ruby on rails and haml, but I'm looking for a similar behavior to this:

input type="file" accept=".gif,.jpg,.jpeg,.png,.doc,.docx">

but, with my code:

= f.file_field :document_file, class: 'margin-none'

I tried add it like a new parameter, but doesn't works. Does Someone has an idea?

Upvotes: 0

Views: 144

Answers (1)

Kimooz
Kimooz

Reputation: 961

=f.file_field(: document_file, accept: 'image/png,image/gif,image/jpeg,image/jpg,image/doc,image/docx',class: 'margin-none')

Upvotes: 1

Related Questions