saving the image

Try:
filename = "#{RAILS_ROOT}/public/images/userimg/" +
@file.original_filename

Be aware that this could be abused. It might be possible for someone
to put ../ in the filename and do something malicious like add a
controller to your application or overwrite your log files.

~Rusty