er ` ](/en-
US/docs/Web/API/DataTransfer) object.

A ` File ` object is a specific kind of [ ` Blob ` ](/en-US/docs/Web/API/Blob)
, and can be used in any context that a Blob can. In particular, [ `
FileReader ` ](/en-US/docs/Web/API/FileReader) , [ ` URL.createObjectURL() `
](/en-US/docs/Web/API/URL/createObjectURL_static "URL.createObjectURL\(\)") ,
[ ` createImageBitmap() ` ](/en-US/docs/Web/API/createImageBitmap) , the [ `
body ` ](/en-US/docs/Web/API/fetch#body) option to [ ` fetch() ` ](/en-
US/docs/Web/API/fetch) , and [ ` XMLHttpRequest.send() ` ](/en-
US/docs/Web/API/XMLHttpRequest#send\(\)) accept both ` Blob ` s and ` File `
s.

See [ Using files from web applications ](/en-
US/docs/Web/API/File_API/Using_files_from_web_applications) for more
information and examples.

Blob  File

##  Constructor

[ ` File() ` ](/en-US/docs/Web/API/File/File "File\(\)")

    

Returns a newly constructed ` File ` .

##  Instance properties

_The` File ` interface also inherits properties from the [ ` Blob ` ](/en-
US/docs/Web/API/Blob) interface. _

[ ` File.lastModified ` ](/en-US/docs/Web/API/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 ` ](/en-US/docs/Web/API/File/lastModifiedDate)
Deprecated  Read only  Non-standard

    

Returns the last modified [ ` Date ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/Date) of the file referenced
by the ` File ` object.

[ ` File.name ` ](/en-US/docs/Web/API/File/name) Read only

    

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

[ ` File.webkitRelativePath ` ](/en-US/docs/Web/API/File/webkitRelativePath)
Read only

    

Returns the path the URL of the [ ` File ` ](/en-US/docs/Web/API/File) is
relative to.

##  Instance methods

_The` File ` interface also inherits methods from the [ ` Blob ` ](/en-
US/docs/Web/API/Blob) interface. _

##  Specifications

Specification  
---  
[ File API  
#  file-section  ](https://w3c.github.io/FileAPI/#file-section)  
  
##  Browser compatibility

BCD tables only load in the browser  with JavaScript enabled. Enable
JavaScript to view data.

##  See also

  * [ Using files from web applications ](/en-US/docs/Web/API/File_API/Using_files_from_web_applications)
  * [ ` FileReader ` ](/en-US/docs/Web/API/FileReader)

##  Help improve MDN

Was this page helpful to you?

Yes  No

[ Learn how to contribute
](https://github.com/mdn/content/blob/main/CONTRIBUTING.md "This will take you
to our contribution guidelines on GitHub.") .

This page was last modified on  Dec 2, 2023  by  [ MDN contributors ](/en-
US/docs/Web/API/File/contributors.txt) .

[ View this page on GitHub
](https://github.com/mdn/content/blob/main/files/en-
us/web/api/file/index.md?plain=1 "Folder: en-us/web/api/file \(Opens in a new
tab\)") â¢  [ Report a problem with this content
](https://github.com/mdn/content/issues/new?template=page-report.yml&mdn-
url=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-
US%2Fdocs%2FWeb%2FAPI%2FFile&metadata=%3C%21--+Do+not+make+changes+below+this+line+--%3E%0A%3Cdetails%3E%0A%3Csummary%3EPage+report+details%3C%2Fsummary%3E%0A%0A*+Folder%3A+%60en-
us%2Fweb%2Fapi%2Ffile%60%0A*+MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-
US%2Fdocs%2FWeb%2FAPI%2FFile%0A*+GitHub+URL%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fblob%2Fmain%2Ffiles%2Fen-
us%2Fweb%2Fapi%2Ffile%2Findex.md%0A*+Last+commit%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fcommit%2F8fd2ee72038310e3ecc387df235ffac1cb08775c%0A*+Document+last+modified%3A+2023-12-02T09%3A32%3A56.000Z%0A%0A%3C%2Fdetails%3E
"This will take you to GitHub to file a new issue.")

[ MDN logo  ](/)

Your blueprint for a better internet.

  * [ MDN on Mastodon  ](https://mozilla.social/@mdn)
  * [ MDN on X (formerly Twitter)  ](https://twitter.com/mozdevnet)
  * [ MDN on GitHub  ](https://github.com/mdn/)
  * [ MDN Blog RSS Feed  ](/en-US/blog/rss.xml)

##  MDN

  * [ About ](/