How to order dragged files equal to its original order from the directory?

user9446405 Source

It seems that when dragging a file to a draggable box, using dataTransfer.files, it orders the highlighted/selected files based on the one you clicked to dragged.

If you highlighted 4 images, but you clicked on the third image of the directory to drag over to its appropriate place. The files order would be 3rd image, 4th image then 1st and 2sc. regardless of its original position, to have it in order just like its directory, I would have to highlight them four and then click on the first image of the directory and drag it across.

Is there a way to order it by its directory, or by the webpage html order. Since the html orders it by the order's directory.

 function handleFileSelect(evt) {

        var files = evt.dataTransfer.files; // FileList object.
var uploadFile = function (files) {
        var formData = new FormData();
        var request = new XMLHttpRequest();
        var i;

        for(i = 0; i<files.length; i = i+1){
            formData.append('file[]', files[i]);
        request.onload = function(){
           // var data = this.responseText;
        };'post', 'a.php');


comments powered by Disqus