<img style="display: none" id="upload_org_code_img" src="" width="150" height="150">
<input type="file" id="user">
<input id="file_upload_image" name="thumb" type="hidden" value="">
$('#user').change(function () {
var files = document.getElementById('user').files[0]
var formData = new FormData();
formData.append("file", files)
console.log(formData)
$.ajax({
type: "post",
url: "{:url('api/image/upload')}",
contentType: false,
processData: false,
data: formData,
async: false,
dataType: 'json',
success: function (res) {
if (res.code == 1) {
$("#upload_org_code_img").attr("src", res.data);
$("#file_upload_image").attr("value", res.data);
$("#upload_org_code_img").show();
$(".img-circle").hide()
}else {
layer.msg(res.msg)
}
}
})
})