Returns the name of the file represented by a File object. For security reasons, the path is excluded from this property.


var name =;


A string, containing the name of the file without path, such as "My Resume.rtf".


<input type="file" multiple onchange="processSelectedFiles(this)">
function processSelectedFiles(fileInput) {
  var files = fileInput.files;

  for (var i = 0; i < files.length; i++) {
    alert("Filename " + files[i].name);

Try the results out below:


Specification Status Comment
File API
The definition of 'name' in that specification.
Working Draft Initial definition.

Browser compatibility

BCD tables only load in the browser

See also