instance method multipart_body

Ruby on Rails 2.3.18

Since v2.2.3 Last seen in v2.3.18 Private

Available in: v2.2.3 v2.3.18

Signature

multipart_body(params, boundary)

No documentation comment.

Parameters

params req
boundary req
Source
# File actionpack/lib/action_controller/integration.rb, line 442
        def multipart_body(params, boundary)
          multipart_requestify(params).map do |key, value|
            if value.respond_to?(:original_filename)
              File.open(value.path, "rb") do |f|
                f.set_encoding(Encoding::BINARY) if f.respond_to?(:set_encoding)

                <<-EOF
--#{boundary}\r
Content-Disposition: form-data; name="#{key}"; filename="#{CGI.escape(value.original_filename)}"\r
Content-Type: #{value.content_type}\r
Content-Length: #{File.stat(value.path).size}\r
\r
#{f.read}\r
EOF
              end
            else
<<-EOF
--#{boundary}\r
Content-Disposition: form-data; name="#{key}"\r
\r
#{value}\r
EOF
            end
          end.join("")+"--#{boundary}--\r"
        end

Defined in actionpack/lib/action_controller/integration.rb line 442 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionController::Integration::Session

Type at least 2 characters to search.

↑↓ navigate · open · esc close