# class Rack::Multipart::Parser::Collector::MimePart

### Public Instance Methods

get_data() { |data| ... } click to toggle source

    # File lib/rack/multipart/parser.rb, line 126
    def get_data
      data = body
      if filename == ""
        # filename is blank which means no file has been selected
        return
      elsif filename
        body.rewind if body.respond_to?(:rewind)

        # Take the basename of the upload's original filename.
        # This handles the full Windows paths given by Internet Explorer
        # (and perhaps other broken user agents) without affecting
        # those which give the lone filename.
        fn = filename.split(/[\/\\]/).last

        data = { filename: fn, type: content_type,
                name: name, tempfile: body, head: head }
      end

      yield data
    end