0
fs.addEventListener('change', function () {

    for (name of this.files)
        console.log(name)
    }

});`

What's wrong with my computer? Windows 7;

Kalana
  • 5,631
  • 7
  • 30
  • 51
  • `const name`. This fails in strict mode — for a good reason. Use [modules](//developer.mozilla.org/en/docs/Web/JavaScript/Guide/Modules), not scripts in sloppy mode. – Sebastian Simon Dec 15 '22 at 14:39

1 Answers1

0

Please try below snipet to for file name

fs.addEventListener('change', getFileData);

function getFileData() {
  const files = this.files;  
  for ( let i = 0; i < files.length; i++) {
   console.log("file " + (i+1) +" name", files[i].name);    
  }
}