# File lib/ramaze/helper/upload.rb, line 79
      def get_uploaded_files(pattern = nil)
        uploaded_files = {}

        # Iterate over all request parameters
        request.params.each_pair do |k, v|
          # If we use a pattern, check that it matches
          if pattern.nil? or pattern =~ k
            # Rack supports request parameters with either a single value or
            # an array of values. To support both, we need to check if the
            # current parameter is an array or not.
            if v.is_a?(Array)
              # Got an array. Iterate through it and check for uploaded files
              file_indices = []

              v.each_with_index do |elem, idx|
                file_indices.push(idx) if is_uploaded_file?(elem)
              end

              # Convert found uploaded files to
              # Ramaze::Helper::Upload::UploadedFile objects
              file_elems = []

              file_indices.each do |fi|
                file_elems << Ramaze::Helper::Upload::UploadedFile.new(
                  v[fi][:filename],
                  v[fi][:type],
                  v[fi][:tempfile],
                  ancestral_trait[:upload_options] ||
                  Ramaze::Helper::Upload::ClassMethods.trait[
                    :default_upload_options
                  ]
                )
              end

              # Remove uploaded files from current request param
              file_indices.reverse_each do |fi|
                v.delete_at(fi)
              end

              # If the request parameter contained at least one file upload,
              # add upload(s) to the list of uploaded files
              uploaded_files[k] = file_elems unless file_elems.empty?

              # Delete parameter from request parameter array if it doesn't
              # contain any other elements.
              request.params.delete(k) if v.empty?
            else
              # Got a single value. Check if it is an uploaded file
              if is_uploaded_file?(v)
                # The current parameter represents an uploaded file.
                # Convert the parameter to a
                # Ramaze::Helper::Upload::UploadedFile object
                uploaded_files[k] = Ramaze::Helper::Upload::UploadedFile.new(
                  v[:filename],
                  v[:type],
                  v[:tempfile],
                  ancestral_trait[:upload_options] ||
                  Ramaze::Helper::Upload::ClassMethods.trait[
                    :default_upload_options
                  ]
                )

                # Delete parameter from request parameter array
                request.params.delete(k)
              end
            end
          end
        end

        # If at least one file upload matched, override the uploaded_files
        # method with a singleton method that returns the list of uploaded
        # files. Doing things this way allows us to store the list of uploaded
        # files without using an instance variable.
        unless uploaded_files.empty?
          @_ramaze_uploaded_files = uploaded_files

          # Save uploaded files if autosave is set to true
          if ancestral_trait[:upload_options] and
             ancestral_trait[:upload_options][:autosave]
            uploaded_files().each_value do |uf|
              uf.save
            end
          end
        end

        # The () is required, otherwise the name would collide with the variable
        # "uploaded_files".
        return uploaded_files()
      end