我试图连接我的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 %>