Hi team,
I doing one rails application , i have doubt i can create user form
and
upload images , i did create user(using session ) and create tmp folder
and
save the database my issue is
my error is:
undefindedmeth’[]’
error came that place:
name= Upload[‘imagepath’].original_filename
please slove the problem
my code :
@login=Upload.new(params[:userform])
session[:user] = Upload.new(params[:userform])
@sn= session[:user].name
@pn= session[:user].email
@ss=FileUtils.mkdir_p(“tmp/session/#{@sn}”)
name= Upload[‘imagepath’].original_filename
directory=“tmp/session/#{@sn}”
path=File.join(directory,name)
@str=directory+"/"+name
File.open(path,“wb”){|f|f.write(upload[‘imagepath’].read)}
@upload=Upload.new
#@upload=ImagePath.save(params[:upload])
@upload[‘name’]=@sn
@upload[‘email’]=@pn
@upload[‘userpath’]=@ss
#@upload[‘imagepath’]=@str
#@upload=DataFile.save(params[:upload])
@upload.save
puts “****************”
puts @sn
puts @ss
#puts @str
end
def uploadfile