7

I have a element (that allows multiple file uploads). I would like to use javascript/jquery to get a list of the files that have been selected for upload. Is this possible?

The element looks like

<input type="file" name="files[]" multiple/>

I am receiving the files with a Play Framework (Java) controller - however that's not really useful for the question.

Ankur
  • 50,282
  • 110
  • 242
  • 312
  • What kind of element is it ? and how are you adding those file upload inputs please share some code. – yogi Oct 22 '12 at 08:31

1 Answers1

14

You can get the list from the input element's "files" property. I think this link can help you. Javascript get number of files and their filenames from file input element with multiple attribute?

Example:

$files = $('#fileInput').files;
for (var i=0, l=files.length; i<l; i++) {
     console.log(files[i].name);
}
Community
  • 1
  • 1
artsylar
  • 2,648
  • 4
  • 34
  • 51