HTML and CSS Reference
In-Depth Information
Table B.31. FileList API
Attribute/method
Description
length
Number of files in the list.
item(index)
Gets the file at the given index (zero-based).
Table B.32 lists attributes and methods associated with the FileReader object. A
File-Reader object lets web applications asynchronously read the contents of files (or
raw data buffers) stored on the user's computer, using File or Blob objects to specify the
file or data to read.
Table B.32. FileReader API
Attribute/method
Description
abort()
Aborts reading the file
Reads the contents of the blob (which is either a File or a Blob object) into an array buf-
fer.
readAsArrayBuffer(blob)
readAsDataURL(blob)
Reads the contents of a Blob or File object and returns a data: URL to it.
Reads the contents of a Blob or File object into a text string if the optional encoding para-
meter is specified (e.g., 'ISO-8859-1' or 'UTF-8'); then the string will be encoded using
that character set.
readAsText(blob,[encoding])
error
If an error occurs, it will be loaded into this property.
readyState
The state of the file read operation (0 = EMPTY, 1 = LOADING, 2 = DONE).
This will be populated with the file's contents when a read operation has been completed.
The format of the result will depend on the method used to read the file.
result
Table B.33 lists events associated with the FileReader object.
Table B.33. FileReader events
Event name
Description
abort
Fires when the read operation is aborted.
error
Fires when an error occurs while reading the file.
load
Fires when the read operation has successfully completed.
loadend
Fires after onload or onerror, regardless of whether the operation was successful.
loadstart
Fires when the read operation is about to start.
progress
Fires periodically during the read operation.
 
 
 
Search WWH ::




Custom Search