Reputation: 905
<input type="file" id="fup" multiple/>
alert($("#fup").val());
Here I am getting only single file in the alert()
even though I am selecting multiple files.
How can I get multiple files in the alert() with complete url path
?
Upvotes: 0
Views: 40
Reputation: 337560
Use the files
collection of the underlying DOMElement:
var files = $('#fup')[0].files;
for (var i = 0; i < files.length; i++) {
console.log(files[i].name);
}
Also note that you shouldn't use alert()
for debugging. It coerces the datatypes and is generally not a good idea. The console is always preferable.
Upvotes: 1