thoughtbot/paperclip — Issue #645: failing to upload files with multiple chunks
Author: mabid
Created: 2011-11-15 20:28:38+00:00
State: open

Does paperclip support chunked uploads ? I am uploading files using plupload. It has a chunks option.

Here's my code in the controller

tempfile = Tempfile.new('raw-upload.')
env['rack.input'].each do |chunk|
tempfile << chunk.force_encoding('UTF-8')
end
tempfile.flush
tempfile.rewind

multipart_hash = {
:picture=> {
:filename => params[:name],
:type => MIME::Types.type_for(params[:name]).first,
:tempfile => tempfile
}
}

@photo.picture = multipart_hash[:picture]
@photo.picture_content_type = MIME::Types.type_for(params[:name]).to_s if params.has_key?(:name)
@photo.save!

The photo is saved but no attachments are saved and no error shows up.

I am using rails3.1 and ruby 1.9.2.