How to upload multiple files using PHP, jQuery and AJAX

Finally I have found the solution by using the following code: $(‘body’).on(‘click’, ‘#upload’, function(e){ e.preventDefault(); var formData = new FormData($(this).parents(‘form’)[0]); $.ajax({ url: ‘upload.php’, type: ‘POST’, xhr: function() { var myXhr = $.ajaxSettings.xhr(); return myXhr; }, success: function (data) { alert(“Data Uploaded: “+data); }, data: formData, cache: false, contentType: false, processData: false }); return false; });