将多个文件附加到Form Data对象

in this code i am using Ajax in order to post the file contents to a php page for further processing. But on my php page i only get the one file details when i use $_FILES. The code is below.

var i = 0,
    length = $('.input2').length;
var images = new Array();

var images = document.getElementsByClassName('input2');

var data = new FormData();

for (i = 0; i < length; i++) {
    data.append(i, images[i].files[i]);
    alert(i);
}


$.ajax({
    url: 'product_image_gallery_process.php',
    data: data,
    processData: false,
    contentType: false,
    type: 'POST',
    success: function (msg) {
        alert(msg);
    }
});

so please let me know what modifications i have to make in order to get all the files on the server side.