module CGI::HtmlExtension
def multipart_form(action = nil, enctype = "multipart/form-data")
multipart_form("url") { "string" }
#
multipart_form{ "string" }
Alternatively, the attributes can be specified as a hash.
type, which defaults to "multipart/form-data".
+action+ is the action to perform. +enctype+ is the encoding
Multipart encoding is used for forms that include file uploads.
Generate a Form element with multipart encoding as a String.
def multipart_form(action = nil, enctype = "multipart/form-data") attributes = if action == nil { "METHOD" => "post", "ENCTYPE" => enctype } elsif action.kind_of?(String) { "METHOD" => "post", "ACTION" => action, "ENCTYPE" => enctype } else unless action.has_key?("METHOD") action["METHOD"] = "post" end unless action.has_key?("ENCTYPE") action["ENCTYPE"] = enctype end action end if block_given? form(attributes){ yield } else form(attributes) end end