javascript - What does <input type="file">create, a FileUpload Object or a FileList? -


in html file, wrote:

<input type="file" id="xmlfile" onchange="handlefiles(this)"/>. 

w3school says "for each tag in html form, fileupload object created." , indeed succeeded in getting path of file using code following in js script:

function handlefiles(ifile){ var path = ifile.value; } 

but there opinion <input type="file"> returns filelist. confused. if returns list of files, there list of paths. in case, "ifile.value" mean ? list of paths of files ? in advance.

console.log(object) function used see objects of javascript in chrome developer tools.

  function handlefiles(ifile) {             var path = ifile.value;             console.log(ifile);             console.log(path);   } 

here output:

<input type="file" id="xmlfile" onchange="handlefiles(this)"> c:\fakepath\readme  

from here can <input type="file"> or ifile parameter returns fileupload object , ifile.value path chosen uploaded.


Comments