module CGI::HtmlExtension
def file_field(name = "", size = 20, maxlength = nil)
file_field("NAME" => "name", "SIZE" => 40)
#
file_field("name", 40, 100)
#
file_field("name", 40)
#
file_field("name")
See #multipart_form() for forms that include file uploads.
Alternatively, the attributes can be specified as a hash.
of the file's _name_, not of the file's _contents_.
+name+, +size+, and +maxlength+. +maxlength+ is the maximum length
The attributes of the element can be specified as three arguments,
Generate an File Upload Input element as a string.
def file_field(name = "", size = 20, maxlength = nil) attributes = if name.kind_of?(String) { "TYPE" => "file", "NAME" => name, "SIZE" => size.to_s } else name["TYPE"] = "file" name end attributes["MAXLENGTH"] = maxlength.to_s if maxlength input(attributes) end