Hi,
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.
Thanks in advance
Hi,
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.
Thanks in advance
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
Chris Mear 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 "