mardi 4 août 2015

rails upload file from local database to S3

Hi i have rails app in that i stored all files in database when i click on upload button then that file must upload on s3 and stored file reference in database Currently i am use following way but its not working not getting file object

 <% @documents.each do |fileData| %>
  <tr>
    <td><%= fileData.filename %></td>
    <td><%= link_to 'Upload file', '#', :onclick => "getFile(#{fileData.id})" %></td>
    <td><%= button_to 'Destroy', fileData, method: :delete, data: { confirm: 'Are you sure?' } %></td>
  </tr>
<% end %>

so how to send file object in javaScript function :onclick => getFile(fileObject)

Aucun commentaire:

Enregistrer un commentaire