Hi Everyone, Am getting an error while uploading file in application... here is the code and the error Code:- File.open("#{RAILS_ROOT}/images/#{params[:id]}", ''wb+'') do |f| f.write params[:content][:picture].read end Error:- Errno::ENOENT in ContentController#update No such file or directory - ./images/1 Request Parameters: {"multipart"=>"true", "commit"=>"Update", "id"=>"1", "content"=>{"title"=>"Test 1", "startDt(1i)"=>"2006", "startDt(2i)"=>"12", "description"=>"Test Description 1 a", "startDt(3i)"=>"3", "picture"=>"C:\\Documents and Settings\\kalyava\\My Documents\\My Pictures\\Beautiful Quotations\\CA03SREF.jpg"}} Think the file couldn''t be created for some reason. I searched in google but couldn''t get any proper solution. Can anyone guide me?? Am stuck up with this for almost 4 days now... :-( Thanks in advance Regards, Vasanth -- 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Vasanthakumar Csk wrote:> Hi Everyone, > Am getting an error while uploading file in application... here > is the code and the error > > Code:- > File.open("#{RAILS_ROOT}/images/#{params[:id]}", ''wb+'') do |f| > f.write params[:content][:picture].read > end > > Error:- > Errno::ENOENT in ContentController#update > No such file or directory - ./images/1 > > Request Parameters: {"multipart"=>"true", "commit"=>"Update", "id"=>"1", > "content"=>{"title"=>"Test 1", "startDt(1i)"=>"2006", > "startDt(2i)"=>"12", "description"=>"Test Description 1 a", > "startDt(3i)"=>"3", "picture"=>"C:\\Documents and Settings\\kalyava\\My > Documents\\My Pictures\\Beautiful Quotations\\CA03SREF.jpg"}} > > Think the file couldn''t be created for some reason. I searched in google > but couldn''t get any proper solution. Can anyone guide me?? Am stuck up > with this for almost 4 days now... :-( > > Thanks in advance > Regards, > Vasanthcreate a folder with name images in your rails directory.i hope it will work. -- 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Vasanthakumar Csk
2006-Dec-11 10:32 UTC
Re: File uploading error - No such file or directory
Yes it worked.... but am getting another error now, Error: NoMethodError in ContentController#update undefined method `read'' for #<String:0x687f5b8> Any solution to this?? -- 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---