Firefox Tomorrow

web api interface

File

View on MDN ↗

Available in workers

The File interface provides information about files and allows JavaScript in a web page to access their content.

File objects are generally retrieved from a FileList object returned as a result of a user selecting files using the <input> element, or from a drag and drop operation’s DataTransfer object.

A File object is a specific kind of Blob, and can be used in any context that a Blob can. In particular, the following APIs accept both Blobs and File objects:

See Using files from web applications for more information and examples.

Constructor

  • File()
    • : Returns a newly constructed File.

Instance properties

The File interface also inherits properties from the Blob interface.

  • lastModified Read only
    • : Returns the last modified time of the file, in millisecond since the UNIX epoch (January 1st, 1970 at Midnight).
  • lastModifiedDate Deprecated Read only
    • : Returns the last modified Date of the file referenced by the File object.
  • name Read only
    • : Returns the name of the file referenced by the File object.
  • webkitRelativePath Read only
    • : Returns the path the URL of the File is relative to.

Instance methods

The File interface also inherits methods from the Blob interface.

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also