My code when upload image
class DataFile < ActiveRecord::Base
def self.save(upload)
name = upload[''datafile''].original_filename
directory = "public/free"
# create the file path
path = File.join(directory, name)
# write the file
File.open(path, "wb") { |f|
f.write(upload[''datafile''].read) }
end
end
but i upload image have name: image1.jpg is it show : undefined method
`original_filename'' for "images2.jpg":String
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.