Ajax can not send files (jpg-png). I could not solve the problem.
form code
<form action="upload.php" method="post" enctype="multipart/form-data">
 <label for="img"> 
  <button id="post-img">update</button>
  <!-- input hidden !! -->
  <input type="file" name="img" id="a-img" style="visibility:hidden">
</label>
ajax:
$('#a-img').change(function(){
  var photo = $('form').serialize();
  $.ajax({
    url:'upload.php',
    data: photo,
    success:function(data){
        alert(data);
    }
   });
});
php code:
if($_FILES){
 echo "file ok";
}else{
 echo "no file"; 
}
callback : "no file";
 
     
    