Reputation: 770
I've been breaking my head to get this working in Rails file tag. I just want to make a file field accept multiple files. For that I need the name to be "attachment[]" instead of "attachment". But for the life of me, I can not figure this out.
How do I convert this simple HTML?
<input type="file" name="attachment[]" id="folderinput" multiple="" directory="" webkitdirectory="" mozdirectory="">
I have this,
<%= file_field_tag :attachment, multiple: true, id: "folderinput", style: "display:none;", "webkitdirectory"=> "", "directory"=> "" %>
Upvotes: 0
Views: 154
Reputation: 1613
You can use <%= file_field_tag "attachment", multiple: true, id: "folderinput",name: "attachment[]", style: "display:none;", "webkitdirectory"=> "", "directory"=> "" %>
Upvotes: 0
Reputation: 18670
How about replacing :attachment
by "attachment[]"
?
<%= file_field_tag "attachment[]", multiple: true, id: "folderinput", style: "display:none;", "webkitdirectory"=> "", "directory"=> "" %>
Upvotes: 1