# module Rack::Multipart

A multipart form data parser, adapted from IOWA.

Usually, Rack::Request#POST takes care of calling this.

### Constants

ATTRIBUTE
ATTRIBUTE_CHAR

  Updated definitions from RFC 2231

BROKEN
CONDISP
DISPPARM
EOL
EXTENDED_INITIAL_NAME
EXTENDED_INITIAL_PARAMETER
EXTENDED_INITIAL_VALUE
EXTENDED_OTHER_NAME
EXTENDED_OTHER_PARAMETER
EXTENDED_OTHER_VALUE
EXTENDED_PARAMETER
MULTIPART
MULTIPART_BOUNDARY
MULTIPART_CONTENT_DISPOSITION
MULTIPART_CONTENT_ID
MULTIPART_CONTENT_TYPE
REGULAR_PARAMETER
REGULAR_PARAMETER_NAME
RFC2183
SECTION
TOKEN
VALUE

### Public Class Methods

build_multipart(params, first = true) click to toggle source

    # File lib/rack/multipart.rb, line 58
    def build_multipart(params, first = true)
      Generator.new(params, first).dump
    end

extract_multipart(req, params = Rack::Utils.default_query_parser) click to toggle source

    # File lib/rack/multipart.rb, line 44
    def extract_multipart(req, params = Rack::Utils.default_query_parser)
      io = req.get_header(RACK_INPUT)
      io.rewind
      content_length = req.content_length
      content_length = content_length.to_i if content_length

      tempfile = req.get_header(RACK_MULTIPART_TEMPFILE_FACTORY) || Parser::TEMPFILE_FACTORY
      bufsize = req.get_header(RACK_MULTIPART_BUFFER_SIZE) || Parser::BUFSIZE

      info = Parser.parse io, content_length, req.get_header('CONTENT_TYPE'), tempfile, bufsize, params
      req.set_header(RACK_TEMPFILES, info.tmp_files)
      info.params
    end

parse_multipart(env, params = Rack::Utils.default_query_parser) click to toggle source

    # File lib/rack/multipart.rb, line 40
    def parse_multipart(env, params = Rack::Utils.default_query_parser)
      extract_multipart Rack::Request.new(env), params
    end