module Rack::Multipart
A multipart form data parser, adapted from IOWA.
Usually, Rack::Request#POST
takes care of calling this.
Constants
- EOL
- Error
-
Base class for multipart exceptions that do not subclass from other exception classes for backwards compatibility.
- MULTIPART
- MULTIPART_BOUNDARY
- MULTIPART_CONTENT_DISPOSITION
- MULTIPART_CONTENT_ID
- MULTIPART_CONTENT_TYPE
Public Class Methods
Source
# File lib/rack/multipart.rb, line 72 def build_multipart(params, first = true) Generator.new(params, first).dump end
Source
# File lib/rack/multipart.rb, line 68 def extract_multipart(request, params = Rack::Utils.default_query_parser) parse_multipart(request.env) end
Source
# File lib/rack/multipart.rb, line 48 def parse_multipart(env, params = Rack::Utils.default_query_parser) unless io = env[RACK_INPUT] raise MissingInputError, "Missing input stream!" end if content_length = env['CONTENT_LENGTH'] content_length = content_length.to_i end content_type = env['CONTENT_TYPE'] tempfile = env[RACK_MULTIPART_TEMPFILE_FACTORY] || Parser::TEMPFILE_FACTORY bufsize = env[RACK_MULTIPART_BUFFER_SIZE] || Parser::BUFSIZE info = Parser.parse(io, content_length, content_type, tempfile, bufsize, params) env[RACK_TEMPFILES] = info.tmp_files return info.params end