[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ko/docs/Web/API/HTMLInputElement/files [Back]  [Original]

HTMLInputElement: files property - Web API | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

HTMLInputElement: files property

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 7.

HTMLInputElement.files <input type="file"> FileList .

In this article

FileList . **HTMLInputElement** type="file" null.

HTMLInputElement.files , , .

HTML

html
<input id="files" type="file" multiple />

JavaScript

**HTMLInputElement.files** FileList . for...of .

js
const fileInput = document.getElementById("files");

console.log(fileInput.files instanceof FileList); //  .

for (const file of fileInput.files) {
  console.log(file.name); //   
  let fileDate = new Date(file.lastModified);
  console.log(fileDate.toLocaleDateString()); //    
  console.log(
    file.size < 1000 ? file.size : Math.round(file.size / 1000) + "KB",
  );
  console.log(file.type); // MIME  
}

Specification
HTML
# dom-input-files-dev


Web Proxy Viewer  |  New URL  |  Original Page