file_field(name = "", size = 20, maxlength = nil) public

Generate an File Upload Input element as a string.

The attributes of the element can be specified as three arguments, name, size, and maxlength. maxlength is the maximum length of the file’s name, not of the file’s contents.

Alternatively, the attributes can be specified as a hash.

See #multipart_form() for forms that include file uploads.

  file_field("name")
    # <INPUT TYPE="file" NAME="name" SIZE="20">

  file_field("name", 40)
    # <INPUT TYPE="file" NAME="name" SIZE="40">

  file_field("name", 40, 100)
    # <INPUT TYPE="file" NAME="name" SIZE="40" MAXLENGTH="100">

  file_field("NAME" => "name", "SIZE" => 40)
    # <INPUT TYPE="file" NAME="name" SIZE="40">
Show source
Register or log in to add new notes.