my jquery is
$(document).on("click", ".addthisone", function (e) {
var file_data = $(this).parent().parent().parent().find('input[type=file]').prop("files")[0];
console.log(file_data);
var form_data = new FormData();
form_data.append("file", file_data);
$.ajax({
url: "<?php echo base_url('action/addimage');?>",
//dataType: 'script',
//cache: false,
contentType: false,
processData: false,
data: form_data,
type: 'post',
success: function (d) {
console.log(d);
}
})
e.stopPropagation();
});
console.log()
is displaying file data correctly
but the problem is that it is not appending the file to formData()
, nor i am able to var_dump()
the $_post
after submiting the form. on the controller action it show the empty array
please help me out