Web/API/DataTransfer/files

From Get docs


The DataTransfer.files property is a list of the files in the drag operation. If the operation includes no files, the list is empty.

This feature can be used to drag files from a user's desktop to the browser.

Syntax

dataTransfer.files;

Return value

A list of the files in a drag operation, one list item for each file in the operation. If the drag operation had no files, the list is empty.

Example

There are two live examples of this interface:

Specifications

Specification Status Comment
HTML Living StandardThe definition of 'files' in that specification. Living Standard  
HTML 5.1The definition of 'files' in that specification. Recommendation Initial definition

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
files Chrome

Full support Yes

Edge

Full support 12

Firefox

Full support Yes

IE

?

Opera

Full support Yes

Safari

Full support Yes

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

Full support Yes

Opera Android

Full support Yes

Safari iOS

No support No

Samsung Internet Android

Full support Yes

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown