简体   繁体   English

如何使用simple_form在rails 4中获取此文件(回形针)对象的文件属性?

[英]How to get file attributes of this file (paperclip) object in rails 4 using simple_form?

Im uploading a file into my rails 4 app using paperclip and simple_form with the following code. 我使用回形针和simple_form通过以下代码将文件上传到我的Rails 4应用程序中。

What Id like to do in the following code is substitute the word "file" for the actual file name and extension in the dailogue box. 在下面的代码中,我想做的是用“文件”一词代替“对话”框中的实际文件名和扩展名。 Id also like to customize the message in the dialogue box. 我还想在对话框中自定义消息。 I wonder how to accomplish that. 我不知道如何做到这一点。

views/uploads/_form.html.erb views / uploads / _form.html.erb

 <%= simple_form_for task.uploads.build, :html=> {:multipart => true} do |f| %>
     <%= f.hidden_field :task_id, :value => task.id %>

     <%= f.error_notification %>
     <%= f.file_field :sourcedata %>
     <%= f.button :submit, "Upload this file \nto server" ,:confirm => "Upload File",:class=> "upload_tasks_button"%>

 <% end %>

I appreciate any suggestions to customize the dialogue box. 感谢您提出有关自定义对话框的建议。

Thanks 谢谢

It costs a little bit, but take a look at http://fineuploader.com/ . 它有点花钱,但请访问http://fineuploader.com/ It provide a really rich and powerful UI for file uploads. 它为文件上传提供了真正丰富而强大的用户界面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM