Ruby on rails 无法在Rails 4中使用Transloadit上载照片
我按照上的教程进行了操作,但在未收到通知的情况下无法提交表单:Ruby on rails 无法在Rails 4中使用Transloadit上载照片,ruby-on-rails,file-upload,ruby-on-rails-4,transloadit,Ruby On Rails,File Upload,Ruby On Rails 4,Transloadit,我按照上的教程进行了操作,但在未收到通知的情况下无法提交表单:无法在表单中找到输入[name=params]。单击“确定”后,Transloadit会快速抛出无效的表单数据:表单数据不正确,无法解析,数据永远不会到达我的服务器 我的应用程序正在使用rails4.1.4和jqueryrails2.1.4 这是我的表格: = form_for @profile, url: community_add_photo_path(@profile), html: {id: 'photo_form'} do
无法在表单中找到输入[name=params]
。单击“确定”后,Transloadit会快速抛出无效的表单数据:表单数据不正确,无法解析
,数据永远不会到达我的服务器
我的应用程序正在使用rails4.1.4
和jqueryrails2.1.4
这是我的表格:
= form_for @profile, url: community_add_photo_path(@profile), html: {id: 'photo_form'} do |f|
= render 'shared/error_messages', object: f.object
= transloadit :profile_photo
= hidden_field_tag 'transloadit_template', 'profile_photo'
%table.list
%tr
%td.faded.label Photo Filename
%td= f.file_field :photo, required: true
%tr
%td
%td= f.submit 'Upload'
= transloadit_jquerify :photo_form, wait: true
和我的transloadit.yml
文件:
development:
jquery_sdk_version: 'latest'
auth:
key: 'key'
secret: 'secret'
duration: 1800 # 30 minute validity period for signed upload forms
templates:
profile_photo:
steps:
resize:
height: 256
resize_strategy: 'fillcrop'
robot: '/image/resize'
width: 256
store:
bucket: 'bucket-name'
key: 'key'
path: 'temp/${assembly.id}/${file.name}'
robot: '/s3/store'
secret: 'secret'
有什么建议吗?谢谢 我假设控制器中有params解码器。这就是我所拥有的,它可以工作,但现在要使用jquery,因为我无法控制正在发生的事情
= bootstrap_form_for apr, :remote=> true, html: { :id => "showapr#{apr.id}" , "data-type" => :json, class: 'form-horizontal' } do |f|
= hidden_field_tag :eventid, apr.event.id
= transloadit :video_encode
.fileupload.fileupload-new.pull-left{"data-provides" => "fileupload", style: "padding-right: 5px;"}
.fileupload-preview.thumbnail{:style => "width: 140px; height: 140px;"}
- if apr.upload.present?
- if apr.upload["thumbs"].present?
%img{ :src => apr.upload["thumbs"][0], :style => "width: 140px;height: 140px;"}
-else
%img{"data-src" => "holder.js/140x140/text:Lorem ipsum/social", :src => "", :style => "width: 140px;height: 140px;"}/
- if apr.event.app.check_user_failed == false && (apr.event.start_time.day == Time.zone.now.day)
%div
%span.btn.btn-default.btn-file
%span.fileupload-new Select image
=f.file_field "upload#{apr.id}" , accept: 'video/flv,video/avi,video/mov,video/mp4,video/mpg,video/wmv,video/3gp,video/asf,video/rm,video/swf', :data => {:max_file_size => 30.megabytes}
= transloadit_jquerify "showapr#{apr.id}", :wait => true, :modal=>true, :triggerUploadOnFileSelection=> true
问题在于,您实际上没有将正确的表单数据发布到API,以便它能够正确解决问题 提供:没有参数字段没有提供参数字段 这非常有意义,因为您没有将params字段也传递给API,在使用transloadit的jquery方法时使用该API
params: {
"startdate":"2014-12-02",
"endate":"2014-12-03",
"auth":{
"expires": "2014/12/27 16:53:14+00:00",
"key": "yourKeyValue"
}
}
&signature=yourUniqueSignature
因此,在如何创建参数以发送到API以便transloadit工作时出现了一些问题