# File lib/ramaze/contrib/sequel/image.rb, line 103
    def store(file, uid, hash = {})
      image = new(hash)

      type     = file[:type]
      filename = file[:filename]
      tempfile = file[:tempfile]
      raise ArgumentError, 'Empty tempfile' if tempfile.size == 0

      ext         = Rack::Mime::MIME_TYPES.invert[type]
      image.mime  = type
      target_name = image.next_name(File.basename(filename, File.extname(filename)), ext)
      target_path = File.join(image.public_root, image.path, target_name)

      FileUtils.mkdir_p(File.dirname(target_path))
      FileUtils.cp(tempfile.path, target_path)

      image.original = target_path
      image.save
    end