Не могу понять где накосячил.
<form enctype="multipart/form-data" method="post" id="sumb">
<input type="file" name="uploadfile" id="img" style="display:none;"/>
<label for="img" style="height:auto;width: 133px;border-radius: .25rem;"><img class="img-thumbnail img-responsive" src="../img/new_photo.jpg"></label>
<input type="submit" style="display:none;" id="btn">
<script>
document.getElementById("img").onchange = function() {
document.getElementById("sumb").submit();
var file_data = $('#img').prop('files')[0];
var form_data = new FormData();
form_data.append('file', file_data);
alert(form_data);
$.ajax({
url: '../php/upload_photo.php?id=<?php print_r($id); ?>', // point to server-side PHP script
dataType: 'text', // what to expect back from the PHP script, if anything
cache: false,
contentType: false,
processData: false,
data: form_data,
type: 'post',
success: function(php_script_response){
alert(php_script_response); // display response from the PHP script, if any
}
});
}
</script>