Carrierwave Rails with edit form and file field (no file selected)

When my editable view loads, all of my fields are populated with the record detail, but the file_field shows "No file Selected" next to the browse button. I would prefer that the name of the recording file be specified instead. Why doesn't it show that the file that was downloaded?

Change view

<%= form_for @document, :html => {:multipart => true} do |f| %>
 <%= f.error_messages %>

   <p>
       <%= f.label :file, "File" %><br />
       <%= f.file_field :file %><br />
       <%= f.hidden_field :file_cache %><br />
       <%= f.label :name, "name" %><br />
       <%= f.text_field :name %><br />
       <%= f.label :memo, "memo" %><br />
       <%= f.text_area :memo %>
     </p>
       <%= f.hidden_field :folder_id %>
 <p><%= f.submit "Upload" %></p>
<% end %>

      

+3


source to share


1 answer


I think a good counter is "why should the downloaded file show by default?"
But this is mainly because security reasons and none of the browsers (yes, nothing to do with rails) allow you to do this, so you have to tell the user to manually download the files.



0


source







All Articles