A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/apis/file/FileList/length below:

length · WebPlatform Docs

length Summary

length returns the number of files in the FileList object. If there are no files, this attribute must return 0.

Property of apis/file/FileListapis/file/FileList

Syntax

Note: This property is read-only.

var result = FileList.length;
Return Value

Returns an object of type unsigned longunsigned long

Examples

This example lets you select one or more files, then uses the filelist length to report each filelist item’s name and last modified date/time.

<input type="file" multiple id="myfileinput"><br/>
<input type="button" value="Show file names and last modified dates" onclick="shownd()">
<p>. . .</p>
<script>
function shownd() {
  var fileinp = document.getElementById("myfileinput");
  var filelist = fileinp.files;
  alert(filelist.length);
  for (var i = 0; i < filelist.length; i++) {
    alert(filelist.item(i).name + " was last modified: " + filelist.item(i).lastModifiedDate);
  }
}
</script>
Notes

Returns the number of files that are selected and available on the FileList object. This value can be greater than or equal to 1 if multiple file selection is enabled (typically via the multiple attribute on the input element). If no files have been selected, 0 is returned.

Related specifications
W3C File API Specification
W3C Working Draft
Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4