Chris Mear wrote: > On 14 August 2010 16:12, Yogendra Singh <li...@ruby-forum.com> wrote: >> �I am try to saving the request.raw_post in file and try to saving image >> as regular paperclip saving image... i m getting �the error >> 'Errno::EBADF (Bad file descriptor):' >> >> >> �can anybody tell me how sorted out this. > > Please show us your controller code, and the code around where the > EBADF exception was raised. > > As a wild guess, it sounds like you're trying to pass request.raw_post > directly into Paperclip, while Paperclip is expecting to get a TmpFile > or StringIO object (as it would it you just passed the parameter > containing the file). > > Chris here are my controller code
" name = "tmp_image.png" data = request.raw_post @file_content = File.open("#{RAILS_ROOT}/tmp/#{name}", "wb") { |f| f.write(data) } if data @photo = Picture.new(:image => File.new(@file_content)) @photo.save " -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.