这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
非标
此特征是非标准的,且不在标准轨道中。不要在面向 Web 的生产站点中使用它:它不适用于每个用户。实现之间可能存在大的不兼容性,且行为将来可能改变。
只读
webkitEntries
特性为
HTMLInputElement
interface contains an array of file system entries (as objects based on
FileSystemEntry
) representing files and/or directories selected by the user using an
<input>
element of type
file
, but only if that selection was made using drag-and-drop: selecting a file in the dialog will leave the property empty (bug
1326031).
The array can only contain directories if the
webkitdirectory
特性为
true
. This means the
<input>
element was configured to let the user choose directories.
This property is called
webkitEntries
in the specification due to its origins as a Google Chrome-specific API. It's likely to be renamed someday.
var entries = HTMLInputElement.webkitEntries;
An array of objects based on
FileSystemEntry
, each representing one file which is selected in the
<input>
element. More specifically, files are represented by
FileSystemFileEntry
objects, and, if they're allowed, directories are represented by
FileSystemDirectoryEntry
对象。
This example shows how to create a file selection
<input>
element and process the selected files.
<input id="files" type="file" multiple>
document.getElementById("files").addEventListener("change", function(event) {
event.target.webkitEntries.forEach(function(entry) {
/* do stuff with the entry */
});
});
Each time a
change
event occurs, this code iterates over the selected files, obtaining their
FileSystemEntry
-based objects and acting on them.
| 规范 | 状态 | 注释 |
|---|---|---|
|
文件和目录条目 API
The definition of 'webkitEntries' in that specification. |
草案 | 最初的规范。 |
此 API 没有正式的 W3C 或 WHATWG (Web 超文本应用程序技术工作组) 规范。
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
webkitEntries
非标
|
Chrome 13 | Edge ≤18 | Firefox 50 | IE No | Opera No | Safari 11.1 | WebView Android ≤37 | Chrome Android 18 | Firefox Android 50 | Opera Android No | Safari iOS 11.3 | Samsung Internet Android Yes |
完整支持
不支持
非标。预期跨浏览器支持较差。
HTMLInputElement
labels
multiple
webkitdirectory
webkitEntries
FileError
FileException
FileHandle
FileRequest
FileSystem
FileSystemDirectoryEntry
FileSystemDirectoryEntrySync
FileSystemDirectoryReader
FileSystemDirectoryReaderSync
FileSystemEntry
FileSystemEntrySync
FileSystemFileEntry
FileSystemFileEntrySync
FileSystemFlags
FileSystemSync
LocalFileSystem
LocalFileSystemSync
LockedFile
元数据
Window.requestFileSystem()
Window.resolveLocalFileSystemURL()
WorkerGlobalScope.requestFileSystemSync()