JQuery Drag and Drop files

JQuery Drag and Drop files

Hi,

currently i am working on drag and drop file upload functionality , as per my requirement Users can drag and drop files multiple times (before uploading)  but currently when i drag and drop file 2nd time previously dragged item is removed from the div. How can i append the new file to the previously dragged file and how can i hold the both information in variable.

how can i modify the current function.

obj.on('drop', function (e) {

            $(this).css('border', '2px dotted #0B85A1');
            e.preventDefault();
            var files = e.originalEvent.dataTransfer.files;
            files1 = files;             // I need to capture the all dragged files information to the files1 Variable
            var output = [];
            for (var i = 0; f = files[i]; i++) {
                output.push('<li style="list-style-type:square"><strong>', escape(f.name).replace("%20", " "), '</strong>');
            }
            var x = document.getElementById('list');
           
            x.innerHTML = '<ul>' + output.join('').replace("%20"," ") + '</ul>';

          handleFileUpload(files, obj);
           
        });

please assist me to overcome this issue.