Downloaded PaperClip file gives "do not delete file" when added to session
I need an uploaded PaperClip file in a multi-step form. I went through the same in the session, but it gives me " cannot upload file ".
I have the following method in my controller:
def find_shared_ids
session[:attachment] = params[:participant_attachments][:attachment]
@file_title = params[:participant_attachments][:file_title]
@attachment = ParticipantAttachment.new(activity_params)
end
Below is my model:
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
In the browser, I get this:
Unable to upload file
Parameters:
{"utf8" => "✓", "Authenticity_token" => "d4Ck467KQqL0GOj2Y5hwrDxMI1Dcdbu6TulzmmuFPOg =", "Participant_attachments" => {"attachment" => #, @Original_filename = "150519456ty_2980 , @headers = "Content-Disposition: form-data; name = \" participant_attachments [attachment] \ "; file name = \" 1505352_796594563718005_3237802925919628295_n.jpg \ "\ r \ nContent-Type: image / jpeg \ r \ n"> , "file_title" => "refesf"}, "member_ids" => ""}
I tried to pass the same in hidden_field_tag in my view file. It takes the downloaded file as a string and doesn't help.
Kindly help! :)
source to share
No one has answered this question yet
Check out similar questions: