jump

HTML: The Markup Language (an HTML language reference)

input type=filefile upload control # T

The input element with a type attribute whose value is "file" represents a list of file items, each consisting of a file name, a file type, and a file body (the contents of the file).

Permitted contents #

empty (void element)

Permitted attributes #

global attributes
Any attributes permitted globally.
name = string #
The name part of the name/value pair associated with this element for the purposes of form submission.
disabled = "disabled" or "" (empty string) or empty #
Specifies that the element represents a disabled control.
form = ID reference NEW #
The value of the id attribute on the form with which to associate the element.
type = "file" #
Specifies that its input element represents a list of file items.
accept = list of MIME types #
Provides the UA with a hint of what file types the server is able to accept.
A set of comma-separated strings, each of which is a valid MIME type, with no parameters.
autofocus = "autofocus" or "" (empty string) or empty NEW #
Specifies that the element represents a control to which a UA is meant to give focus as soon as the document is loaded.
required = "required" or "" (empty string) or empty NEW #
Specifies that the element is a required part of form submission.
multiple = "multiple" or "" (empty string) or empty NEW #
Specifies that the element allows multiple values.

Additional constraints and admonitions #

Tag omission #

The input element is a void element. An input element must have a start tag but must not have an end tag.

Permitted parent elements #

any element that can contain phrasing elements

DOM interface #

interface HTMLInputElement : HTMLElement {
           attribute DOMString accept;
           attribute DOMString alt;
           attribute DOMString autocomplete;
           attribute boolean autofocus;
           attribute boolean defaultChecked;
           attribute boolean checked;
           attribute DOMString dirName;
           attribute boolean disabled;
  readonly attribute HTMLFormElement? form;
  readonly attribute FileList? files;
           attribute DOMString formAction;
           attribute DOMString formEnctype;
           attribute DOMString formMethod;
           attribute boolean formNoValidate;
           attribute DOMString formTarget;
           attribute unsigned long height;
           attribute boolean indeterminate;
  readonly attribute HTMLElement? list;
           attribute DOMString max;
           attribute long maxLength;
           attribute DOMString min;
           attribute boolean multiple;
           attribute DOMString name;
           attribute DOMString pattern;
           attribute DOMString placeholder;
           attribute boolean readOnly;
           attribute boolean required;
           attribute unsigned long size;
           attribute DOMString src;
           attribute DOMString step;
           attribute DOMString type;
           attribute DOMString defaultValue;
           attribute DOMString value;
           attribute Date? valueAsDate;
           attribute unrestricted double valueAsNumber;
           attribute unsigned long width;

  void stepUp(optional long n);
  void stepDown(optional long n);

  readonly attribute boolean willValidate;
  readonly attribute ValidityState validity;
  readonly attribute DOMString validationMessage;
  boolean checkValidity();
  void setCustomValidity(DOMString error);

  readonly attribute NodeList labels;

  void select();
           attribute unsigned long selectionStart;
           attribute unsigned long selectionEnd;
           attribute DOMString selectionDirection;

  void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction);
};