WebKitEntry object

Represents a file or directory, as returned by the webkitGetAsEntry method


var dropzone = document.getElementById("dropzone");
dropzone.ondragover = function (e) {
  e.preventDefault()
}

dropzone.ondrop = function(e) {
  e.stopPropagation();
  e.preventDefault();

  cItems = e.dataTransfer.items.length;
  for (var i=0; i < cItems; i++) {

    var entry = e.dataTransfer.items[i].webkitGetAsEntry();
    if (entry.isFile) {
      // Process files
    } else if (entry.isDirectory) {
      // Process folders
    }
  }
}

Members

The WebKitEntry object has these types of members:

Methods

The WebKitEntry object has these methods.

MethodDescription
createReader

Creates a WebKitDirectoryReader object for reading file entries within the given directory.

file

Executes the supplied successCallback or errorCallback on the given file.

 

Properties

The WebKitEntry object has these properties.

PropertyDescription

filesystem

Returns a WebKitFileSystem object representing the directory of the current WebKitEntry.

fullPath

Returns the relative path to the top directory of the WebKitEntry.

isDirectory

Returns true if the WebKitEntry is a WebKitDirectoryEntry, false otherwise.

isFile

Returns true if the WebKitEntry is a WebKitFileEntry, false otherwise.

name

Returns the name of the WebKitEntry, excluding the path leading to it.

 

Remarks

Use the isFile and isDirectory methods to determine the content of the WebKitEntry item. If the item is a directory, you can use the createReader method to instantiate a WebKitDirectoryReader object to traverse the files in the folder (using WebKitDirectoryReader.readEntries).

 

 

Show: