javascript - why does "HTML file select" changes the order of selected files and sort them alphabetically? -
i trying name of files selected "file" input in html:
<input type="file" class="filestyle" name="file-select[]" id="file-select" accept="image/*" multiple>
i wrote javascript code that:
$('#file-select').on("change", function(){ var selectedfiless = this.files; (var = 0; < selectedfiless.length; ++i) { var name = selectedfiless.item(i).name; alert(name); } });
however, noticed names sorted in alphabetical order, not in selection order. example, if select z.jpg , a.jpg, when print names, have a.jpg, z.jpg (alphabetical order). want z.jpg, a.jpg (selection order).
it'll appear based on how have sorted
in system. mean if have set sort by ascending in system irrespective or order select, selected in ascending order , vice versa descending. have tested in code
, results have mentioned above.
a demo test in local systems.
Comments
Post a Comment