PaperClip上传文件给出了"无法转储文件"添加到会话时

时间:2014-08-21 08:14:10

标签: ruby-on-rails-4 paperclip

我需要以多步形式上传PaperClip文件。我在会话中通过了相同的内容,但它给了我" 无法转储文件"。

我的控制器中有以下方法:

def find_shared_ids
  session[:attachment] = params[:participant_attachments][:attachment]  
  @file_title = params[:participant_attachments][:file_title]
  @attachment = ParticipantAttachment.new(activity_params)
end

以下是我的模特:

class ParticipantAttachment < ActiveRecord::Base
  belongs_to :participant
  has_many :shared_attachments, dependent: :destroy
  has_many :participants, through: :shared_attachments
  validates_presence_of :attachment

  has_attached_file :attachment, Paperclip::Attachment.default_options.merge(Settings.participant_attachments.paperclip)

  validates_attachment_content_type :attachment, content_type: ['image/jpeg']
end

我接下来的浏览器:

无法转储文件

参数:

  

{&#34; UTF8&#34; = GT;&#34;✓&#34 ;,   &#34; authenticity_token&#34; = GT;&#34; d4Ck467KQqL0GOj2Y5hwrDxMI1Dcdbu6TulzmmuFPOg =&#34 ;,   &#34; participant_attachments&#34; = GT; {&#34;附件&#34; = GT;#,   @original_filename =&#34; 1505352_796594563718005_3237802925919628295_n.jpg&#34 ;,   @content_type =&#34; image / jpeg&#34;,@ headers =&#34; Content-Disposition:form-data;   命名= \&#34; participant_attachments [附件] \&#34 ;;   文件名= \&#34; 1505352_796594563718005_3237802925919628295_n.jpg \&#34; \ r \ nContent型:   image / jpeg \ r \ n&#34;&gt;,&#34; file_title&#34; =&gt;&#34; refesf&#34;},&#34; participant_ids&#34; =&gt;&#34;& #34;}

我尝试在我的视图文件中的hidden_​​field_tag中传递相同内容。它将上传的文件作为字符串,但没有帮助。

请帮忙! :)

0 个答案:

没有答案