s3_direct_upload rails gem

时间:2014-04-25 06:58:40

标签: javascript ruby-on-rails ruby ruby-on-rails-4

我试图连接我的Rails应用程序以将文件上传到亚马逊s3服务器,但ruby gem s3_direct_upload不起作用。这是我添加的代码。

资产/ javascript

下的star.js.coffee
#= require s3_direct_upload

jQuery ->
  $("#myS3Uploader").S3Uploader
    path: 'path/to/my/files/on/s3'
    additional_data: {key: 'value'}
    remove_completed_progress_bar: false
    before_add: myCallBackFunction # must return true or false if set
    progress_bar_target: $('.js-progress-bars')
    click_submit_target: $('.submit-target')

在uploads.html.erb

    <%= s3_uploader_form callback_url: 'model_url', callback_param: "model[image_url]", id: "s3-uploader" do %>
        <%= file_field_tag :file, multiple: true %>
    <% end %>

0 个答案:

没有答案