$(document).ready(function(){
$('#images').on('change',function(){
var img = $('#images').val();
$.ajax({
type: 'POST',
url: 'upload.php',
data: {img:img},
success: function(data){
alert(data);
}
});
});
});
<imput name="images[]" type="file" id="images" multiple>
$(document).ready(function(){
$("#myFile").on("change", function(){
var inputImg = $(this);
var inputLength = inputImg[0].files.length; //No of files selected
var file;
var formData = new FormData();
for (var i = 0; i < inputLength; i++) {
file = inputImg[0].files[i];
formData.append( 'myFile[]', file);
}
//send POST request to upload.php
$.ajax({
url: "upload.php",
type: "POST",
data: formData,
processData: false,
contentType: false,
beforeSend: function(){
$(".loading").show();
}
}).done(function( data ) {
$(".loading").hide();
$("#resultArea").append(data);
inputImg.val('');
});
});
});