Clarification of "Its required that the file_field_tag is named 'file'" #123

Open
Hengjie opened this Issue Aug 31, 2013 · 0 comments

Comments

Projects
None yet
1 participant
Contributor

Hengjie commented Aug 31, 2013

In the documentation, it clearly states that Its required that the file_field_tag is named 'file'. However, this prevents me from having multiple instances of upload buttons.

I get around it by setting my own ID, like so:

= file_field_tag :file, :id => "file_#{SecureRandom.hex}", :class => "file", multiple: true

From my testing and research, I can't see any problems with this approach. So does this go against the requirement that file_field_tag must be named file?

To elaborate my testing and research: I've read through the code a few times looking for file references to see if there are any references by the JS to #file and it doesn't appear to be the case. I also can't see how this relates to form submission, is there something I'm missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment