Multi step form with image uploader

Actually I solved my problem. Here's working code for multistep forms with file uploading using carrierwave

if params[:user][:img_path]
  @uploaded = params[:user][:img_path]
  params[:user].delete(:img_path)
end
session[:user_data].deep_merge!(params[:user]) if params[:user]
@user = User.new(session[:user_data])    

if @uploaded
  # here how validation will work
  @user.img_path = @uploaded
end
@user.current_stage = session[:register_stage]
if @user.valid?
  if @user.last_stage?
    @user.img_path  = session[:img] if @user.last_stage?
    @user.save
  else  
    @user.next_stage
  end
  # now we can store carrierwave object in session
  session[:img] = @user.img_path
  session[:register_stage] = @user.current_stage
end