File metadata (name, size, type, modified time)
Shows name, byte size, MIME type and last modified time of any file the person shares.
In one line
Can see the name, size, type and last changed date of files you share
Shows name, byte size, MIME type and last modified time of any file the person shares.
Metadata alone can reveal a lot: camera model names, document names, dates of work. The MIME type comes from the person's OS file associations, which also differs between machines.
What it can and can't do
What the user does: You pick or drop a file onto the page.
It can
- See each file's name and size
- See its type and last changed date
- Check the file before it uploads, and refuse it if too big
It cannot
- See the full folder path on your computer
- See files you did not share
- Learn more than that without opening the file's contents
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 13 | 2011-08-02 | None |
| Edge | Supported | 12 | 2015-07-29 | None |
| Firefox | Supported | 3.6 | 2010-01-21 | None |
| Safari | Supported | 8 | 2014-10-16 | None |
| Safari on iPhone | Supported | 8 | 2014-09-17 | All iOS browsers use WebKit |
| Chrome on Android | Supported | 18 | 2012-06-27 | None |
| Samsung Internet | Supported | 1.0 | 2013-04-27 | None |
How a site asks for it
| API | File.name, size, type, lastModified, webkitRelativePath; Blob.slice(), arrayBuffer() |
| Browser compat keys | api.File.nameapi.File.lastModifiedapi.Blob.type |
| How access is granted | none |
| What the user sees | None (no browser prompt) |
| Needs a secure context (HTTPS) | No |
| Needs a user gesture | No |
| Activation | none |
| How long it lasts | While the File object lives |
| How to take it back | Nothing to revoke (no permission is stored) |
| Inside an iframe | Same origin, per file |
Typical flow
- Person shares a file via input, drop, paste or picker
- Page reads the File properties
- Page can slice and read bytes
Data you get
Shape: none
No individual data fields. The signal is the access itself.
Technical limits
- Only for files the person selected, dropped or pasted
- No full path, owner, creation time or hash; lastModified is milliseconds since epoch (filesystem precision may be 1 s or 2 s)
- Firefox resistFingerprinting rounds lastModified (to 100 ms or more) and sets type from extension only
- type is guessed from the extension via the OS registry (Chrome, Windows and macOS differ for unknown types such as .md)
- EXIF and document properties are not exposed natively but can be parsed by the page from the bytes (GPS in photos)
The story
What it is
Shows the name, size, type and last changed time of any file you share.
For you
The page sees the name, size, kind and last changed time of each file you give it. You never see it read, but it is why an upload checks the size first.
For makers
Makers use it to block files that are too big or of the wrong kind before upload. The same details can reveal when a file was made and what kind of device made it.
Where you see it
| Type | Example | Apps |
|---|---|---|
| social | A site refuses a video larger than its limit before you wait for it to upload. | YouTube, Instagram |
| banking | A loan portal checks that your uploads are PDFs or photos, not other file types. | None named |
| security | A fraud team reads the last changed time of an uploaded ID photo to see if it was just edited. | None named |
| games | A mod site checks the name and size of a mod file for known cheats. | None named |
| creative | A music tool reads the file name and type to pick a sound format. | None named |
| education | A homework site checks that the file was last changed before the deadline. | None named |
| enterprise | A document system uses the last changed time to decide which copy is newer. | None named |
Risks
- Reveals file history
- Could hint at your device
What the platform says
- MDN: File API. Documents how a page can read basic details of a file a person has chosen.
Good uses and abuse
Legitimate uses
- Validate upload types and sizes
- Sort by date
Known abuse
- Extracting EXIF GPS and device model from photos
- Fingerprint by installed apps (MIME registry)
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 3 of 5 | How revealing the data is |
| Utility | 4 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | 3 | Rough identifying entropy, when known |
History
- 2015, Chrome 42: File.lastModified (replacing lastModifiedDate)
Related capabilities
Related
- File input (choose files to upload). Can open only the files you pick in the file chooser
- Dropping files and folders onto the page. Can receive files or whole folders you drag onto the page
Sources
How well checked: Based on official documentation.