我在这里使用filepicker rails gem:
https://github.com/Filepicker/filepicker-rails
我想将现有的rails上传表单转换为使用filepicker.io rails gem。现有表单使用rails、bootstrap和datamapper,如下所示:
<%= form_for([@user, @photo],
html: {multipart: true, remote: true, class: 'photo-upload'} ) do |f| %>
<%= f.hidden_field :user_id, value: @user.id %>
<div class="select-files">
<div class="field">
<%= f.label :image, "Select files from your computer" %>
<%= f.file_field :image, multiple: true %>
</div>
</div>
<div class="actions">
<%= f.submit "Upload", class: "btn btn-large btn-primary" %>
</div>
<% end %>我的转换如下所示:
<%= form_for([@user, @photo]) do |f| %>
<div>
<%= f.label :image, "Select files from your computer:" %>
<%= f.filepicker_field :image %>
</div>
<%= f.submit %>
<% end %>我遵循了github项目的文档,但是我没有得到一个文件选择器对话框。是否有使用filepicker.io rails演示工作上传表单的演示或示例代码?我发现了这个:
https://github.com/maxtilford/filepicker-rails-demo
但我不能让它在我的机器上工作。
发布于 2013-06-04 10:35:30
您需要在https://github.com/Filepicker/filepicker-rails上使用较新的github存储库
https://stackoverflow.com/questions/16675609
复制相似问题