W3cubDocs

/DOM

DataTransfer.files

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
WHATWG HTML Living Standard
The definition of 'files' in that specification.
Living Standard
HTML5.1
The definition of 'files' in that specification.
Recommendation Initial definition

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 4 (Yes) 3.5 10 12 3.1
Feature Android Android Webview Chrome for Android Edge Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile
Basic support No support No support No support (Yes) No support No support 10 No support No support

© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/files