self.content_type = uploaded_data.content_type
self.filename = uploaded_data.original_filename
self.image_data = uploaded_data.read
self.size = uploaded_data.size
end
end
In controller, to get the file data and to send it to client :
@picture.image_file = params[:picture] #FileTemp object
@picture.save
end
@image_data = Picture.find(params[:id])
@image = @image_data.binary_data
send_data (@image, :type => @image_data.content_type, :filename => @image_data.filename, :disposition => 'inline')
end
end