1

How do I restrict a file upload input field so that only html.erb files are accepted?

I have an input field like the following:

<%= f.input :upload_field, as: :file, label: false %>

I know the accept setting can control this inside an input_html tag but I am not sure how to implement it correctly.

atw
  • 5,428
  • 10
  • 39
  • 63
  • 1
    I'd suggest checking out this answer. Might be inline with what you're looking to do. This answer shows client side checking as well as server side which would be needed if you really want to trash anything coming in that isn't the specified filetype. http://stackoverflow.com/a/4680972/3366016 – user3366016 Nov 29 '16 at 14:56
  • Ok, I might have to go that route because I don't see .erb in the list of MIME types: https://www.sitepoint.com/web-foundations/mime-types-complete-list// – atw Nov 29 '16 at 14:58

0 Answers0