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:
- Firefox only: http://jsfiddle.net/9C2EF/
- All browsers: https://jsbin.com/hiqasek/
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
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
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
DataTransfer.files by Mozilla Contributors is licensed under CC-BY-SA 2.5.