This line throws an error
var count = files.length;
"Uncaught TypeError: Cannot read property 'length' of undefined" means that variable files is not defined anywhere.
try to to define it, like this for example:
var files = fileU[0].files;
var count = files.length;
console.log(count);
4
solved Select multiple file to upload as populated in html table [closed]