nsIDOMFileList
From MDC
This article covers features introduced in Firefox 3
The nsIDOMFileList interface contains a list of nsIDOMFile objects describing the files selected by the user for a "file" input field on a web form.
All <INPUT> element nodes have a fileList array on them which allows access to the items in this list. For example, if the HTML includes the following file input:
<input id="fileItem" type=file>
The following lines of code each fetch the first file in the node's file list in different formats:
// Get the file's data in UTF-8 (the default text encoding)
document.getElementById('fileItem').fileList[0].getAsText("");
// Get the file's data interpreted as UTF-8 specifically
document.getElementById('fileItem').fileList[0].getAsText("utf8")
// Get the file's data as a data: URL
document.getElementById('fileItem').fileList[0].getAsDataURL()
// Get the file's data as raw binary data
document.getElementById('fileItem').fileList[0].getAsBinary()
Contents |
nsIDOMFileList is defined in content/base/public/nsIDOMFileList.idl. It is scriptable and
unfrozen (hasn't changed since Mozilla 1.9).
Inherits from: nsISupports
[edit] Method overview
nsIDOMFile item(in unsigned long index);
|
[edit] Attributes
| Attribute | Type | Description |
length
| unsigned long
| A read-only attribute indicating the number of files in the list. |
[edit] Methods
[edit] item()
Returns the nsIDOMFile at the specified index in the file list.
nsIDOMFile item( in unsigned long index );
[edit] Parameters
- index
- The zero-based index of the file to retrieve from the list.
[edit] Return value
The nsIDOMFile representing the requested file.
[edit] See also
nsIDOMFile, nsIDOMFileException
Categories: Interfaces | Firefox 3 | DOM