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
I repaired because a multi-part form. Add :multipart=> true to my form_tag.