File

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

* Some parts of this feature may have varying levels of support.

Note: This feature is available in Web 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.

Blob File

Constructor

File()

Returns a newly constructed File.

Instance properties

The File interface also inherits properties from the Blob interface.

File.lastModified Read only

Returns the last modified time of the file, in millisecond since the UNIX epoch (January 1st, 1970 at Midnight).

File.lastModifiedDate Read only

Returns the last modified Date of the file referenced by the File object.

File.name Read only

Returns the name of the file referenced by the File object.

File.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

Specification
File API
# file-section

Browser compatibility

desktop mobile server
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Bun
Deno
Node.js
File
Chrome – Full support
Chrome 13 (Release date: 2011-08-02)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – No support
Firefox 3 – 6 (Release date: 2008-06-17)
footnote Non-standard implementation.
Firefox – Full support
Firefox 7 (Release date: 2011-09-27)
footnote Full support
Opera – Full support
Opera 11.5 (Release date: 2011-06-28)
footnote Full support
Safari – Full support
Safari 4 (Release date: 2009-06-08)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote Full support
Firefox for Android – No support
Firefox for Android 4 – 6 (Release date: 2011-03-29)
footnote Non-standard implementation.
Firefox for Android – Full support
Firefox for Android 7 (Release date: 2011-09-27)
footnote Full support
Opera Android – Full support
Opera Android 11.5 (Release date: 2011-10-12)
footnote Full support
Safari on iOS – Full support
Safari on iOS 3.2 (Release date: 2010-04-03)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – Full support
WebView on iOS 3.2 (Release date: 2010-04-03)
footnote Full support
Bun – Full support
Bun 1 (Release date: 2023-09-08)
footnote Full support
Deno – Full support
Deno 1 (Release date: 2020-05-13)
footnote Full support
Node.js – Partial support
Node.js 18.13 – 18.20 (Release date: 2023-01-06)
footnote Removed in 19 and later
footnote Partial support
footnote Available as a part of the buffer module.
Node.js – Partial support
Node.js 19.2 – 19.9 (Release date: 2022-11-29)
footnote Partial support
footnote Available as a part of the buffer module.
Node.js – Full support
Node.js 20 (Release date: 2023-04-18)
footnote
footnote Before 23.0.0, File instance cannot be cloned.
File() constructor
Chrome – Full support
Chrome 38 (Release date: 2014-10-07)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 28 (Release date: 2014-03-18)
footnote Full support
Opera – Full support
Opera 25 (Release date: 2014-10-15)
footnote Full support
Safari – Full support
Safari 10.1 (Release date: 2017-03-27)
footnote Full support
Chrome Android – Full support
Chrome Android 38 (Release date: 2014-10-08)
footnote Full support
Firefox for Android – Full support
Firefox for Android 28 (Release date: 2014-03-18)
footnote Full support
Opera Android – Full support
Opera Android 25 (Release date: 2014-10-16)
footnote Full support
Safari on iOS – Full support
Safari on iOS 10.3 (Release date: 2017-03-27)
footnote Full support
Samsung Internet – Full support
Samsung Internet 3 (Release date: 2015-04-10)
footnote Full support
WebView Android – Full support
WebView Android 38 (Release date: 2014-10-08)
footnote Full support
WebView on iOS – Full support
WebView on iOS 10.3 (Release date: 2017-03-27)
footnote Full support
Bun – No support
Bun
footnote No support
Deno – Full support
Deno 1 (Release date: 2020-05-13)
footnote Full support
Node.js – No support
Node.js 18.13 – 18.20 (Release date: 2023-01-06)
footnote Removed in 19 and later
Node.js – Full support
Node.js 19.2 (Release date: 2022-11-29)
footnote Full support
lastModified
Chrome – Full support
Chrome 13 (Release date: 2011-08-02)
footnote Full support
Edge – Full support
Edge 18 (Release date: 2018-10-02)
footnote Full support
Firefox – Full support
Firefox 15 (Release date: 2012-08-28)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 10 (Release date: 2016-09-20)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 15 (Release date: 2012-08-28)
footnote Full support
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 10 (Release date: 2016-09-13)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – Full support
WebView on iOS 10 (Release date: 2016-09-13)
footnote Full support
Bun – Full support
Bun 1 (Release date: 2023-09-08)
footnote Full support
Deno – Full support
Deno 1 (Release date: 2020-05-13)
footnote Full support
Node.js – No support
Node.js 18.13 – 18.20 (Release date: 2023-01-06)
footnote Removed in 19 and later
Node.js – Full support
Node.js 19.2 (Release date: 2022-11-29)
footnote Full support
lastModifiedDate
Deprecated Non-standard
Chrome – Full support
Chrome 13 (Release date: 2011-08-02)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – No support
Firefox 15 – 60 (Release date: 2012-08-28)
footnote Removed in 61 and later
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – No support
Safari 7 – 9.1 (Release date: 2013-10-22)
footnote Removed in 10 and later
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – No support
Safari on iOS 7 – 9.3 (Release date: 2013-09-18)
footnote Removed in 10 and later
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – No support
WebView on iOS 7 – 9.3 (Release date: 2013-09-18)
footnote Removed in 10 and later
Bun – No support
Bun
footnote No support
Deno – No support
Deno
footnote No support
Node.js – No support
Node.js
footnote No support
name
Chrome – Full support
Chrome 13 (Release date: 2011-08-02)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 3.6 (Release date: 2010-01-21)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 8 (Release date: 2014-10-16)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 4 (Release date: 2011-03-29)
footnote Full support
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 8 (Release date: 2014-09-17)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – Full support
WebView on iOS 8 (Release date: 2014-09-17)
footnote Full support
Bun – Full support
Bun 1 (Release date: 2023-09-08)
footnote Full support
Deno – Full support
Deno 1 (Release date: 2020-05-13)
footnote Full support
Node.js – No support
Node.js 18.13 – 18.20 (Release date: 2023-01-06)
footnote Removed in 19 and later
Node.js – Full support
Node.js 19.2 (Release date: 2022-11-29)
footnote Full support
webkitRelativePath
Chrome – Full support
Chrome 13 (Release date: 2011-08-02)
footnote Full support
Edge – Full support
Edge 13 (Release date: 2015-11-12)
footnote Full support
Firefox – Full support
Firefox 50 (Release date: 2016-11-15)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 11.1 (Release date: 2018-04-12)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote Full support
Firefox for Android – Partial support
Firefox for Android 141 – 141 (Release date: 2025-07-22)
footnote Partial support
footnote Always an empty string (bug 1973726).
Firefox for Android – Full support
Firefox for Android 142 (Release date: 2025-08-19)
footnote Full support
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 11.3 (Release date: 2018-03-29)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – Full support
WebView on iOS 11.3 (Release date: 2018-03-29)
footnote Full support
Bun – No support
Bun
footnote No support
Deno – No support
Deno
footnote No support
Node.js – No support
Node.js
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
No support
No support
Non-standard. Check cross-browser support before using.
Deprecated. Not for use in new websites.
See implementation notes.
Has more compatibility info.

See also