DataTransfer.files
属性在拖动操作中表示文件列表
。如果操作不包含文件,则此列表为空。
此功能可用于将文件从用户桌面拖动到浏览器。
语法
dataTransfer.files;
返回值
拖动操作中的文件列表
,操作中每个文件的一个列表项。 如果拖动操作没有文件,此列表为空。
举个例子
这个接口有两个实例:
- 只针对Firfox: http://jsfiddle.net/9C2EF/
- 所有浏览器: https://jsbin.com/hiqasek/
规范
Specification | Status | Comment |
---|---|---|
HTML Living Standard files |
Living Standard | |
HTML 5.1 files |
Recommendation | Initial definition |
浏览器兼容性
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
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 | 未实现 | 未实现 | 未实现 | (Yes) | 未实现 | 未实现 | 10 | 未实现 | 未实现 |