简体   繁体   中英

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.

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

 <%= 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/ . It provide a really rich and powerful UI for file uploads.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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