Name
File — a file in the local filesystem
Inherits from
Blob
Synopsis
A File is a Blob that has a name and possibly also a
modification date. It represents a file in the local file system.
Obtain a user-selected file from the files array of an <input type=file> element, or from
the files array of the DataTransfer object associated with the Event object that accompanies a drop
event.
You can also obtain File objects that represent files in a private, sandboxed filesystem, as described in The Filesystem API. The filesystem API is not stable at the time of this writing, however, and it is not documented in this reference section.
You can upload the contents of a file to a server with a FormData object or by passing the File to XMLHttpRequest.send(), but there is not
much else you can do with the File object itself. Use FileReader to read the contents of a File (or of
any Blob).
Properties
readonly DatelastModifiedDateThe modification date of the file, or
nullif it is not available.readonly stringnameThe name of the file (but not its path).
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access