Get to know MDN better
このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
HTMLInputElement.files プロパティを通じて、<input type="file"> 要素で選択された FileList にアクセスできます。
選択されているファイルがあれば、それをリストする FileList オブジェクトです。HTMLInputElement が type="file" でない場合は、null が返ります。
以下の例は、HTMLInputElement.files プロパティにアクセスして、ユーザーが選択したそれぞれのファイルの名前、更新日時、サイズ、種類を出力する方法を示します。
HTMLInputElement.files は、ファイルが選択されていなくても FileList を返すことに注意してください。 この性質があるため、ファイルが選択されているかをチェックせずに for...of で走査しても安全です。
| HTML # dom-input-files-dev |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025年4月12日 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.