Multiple pictures upload jquery.

Multiple pictures upload jquery.

Hey All,

I have working code for uploading a single picture, i want to change this to multiple pictures. I am having some trouble adjusting my code to get the information from all the files. How can i achieve this. I have this code.

<input id=\"file-input\" type=\"file\" multiple>
<div id=\"preview\"></div>
<div> <button class='toevoegen' onclick='uploadpic();'> toevoegen </button> <button > Annuleren </button></div>

function uploadpic(){
                 
var data = [] var data = new FormData(); jQuery.each(jQuery('#file-input')[0].files, function (i, file) { data.append('file-' + i, file); });
 
    
$.ajax({
                                    url: 'dealimage.php',
                                    cache: false,
                                    contentType: false,
                                    processData: false,
                                    type: 'POST',
                                    data: data
});
}