I have <input type="file" id="basicUploadFile" multiple="multiple">
and I want to get all file names inside this input. I've seen some example, but it gets only name of first file.
$ ('#basicUploadFile').live ('change', function () { alert($ ('#basicUploadFile').val()); });
How can I do this? Thanks.
var files = $('#basicUploadFile').prop("files")
files
will be a FileList object.
var names = $.map(files, function(val) { return val.name; });
Now names
is an array of strings (file names)
FileAPI reference
files property reference
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With