When I try a simple file upload and params[:image][:file_name].original_filename in the controller I get an error: "The error occurred while evaluating nil.original_filename". What could be wrong? The form is multipart <% form_tag :action => "create_image", :multipart => true do %> The file field is: <%= file_field ''image'', ''file_name'' %> -- 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 -~----------~----~----~----~------~----~------~--~---
Pål Bergström wrote:> When I try a simple file upload and > params[:image][:file_name].original_filename in the controller I get an > error: "The error occurred while evaluating nil.original_filename". What > could be wrong? The form is multipart <% form_tag :action => > "create_image", :multipart => true do %> > > The file field is: <%= file_field ''image'', ''file_name'' %>Is it that params[:image][:file_name] is just a string, not an object with the method original_filename? What does the rest of the controller code look like in the create? Have you done the @model = Model.new(params[:image]) yet? -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ar Chron wrote:> Is it that params[:image][:file_name] is just a string, not an object > with the method original_filename? > > What does the rest of the controller code look like in the create? Have > you done the @model = Model.new(params[:image]) yet?Could be. I don''t know. It should be an object. I''ll check. I''ve done the Model.new. I''ve taken my code from another app where I got it working, so it should work. Can it be an issue of permissions, that it can''t access the file? Where is the file stored in-between in a file upload? -- 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 -~----------~----~----~----~------~----~------~--~---