<script type="text/javascript">
function image_gen_file(){
var data = new FormData();
$('.file').each(function(i) {
$.each(this.files, function(j) {
data.append('image_' + i, this);
});
});
$.ajax({
url: baseurl + "/image_maker/file",
data: data,
cache: false,
contentType: false,
processData: false,
type: 'POST',
success: function(data){
$(".image_genx").html(data);
}
});
}
</script>
the above code push files to ‘image_maker/file’ now i want to also push an post ‘id’ .. id=23
i tried to do like below but its not working..
In ‘image_maker/file’ it will validate if the files are images.. and to insert in database it needed an ‘id’
$.ajax({
url: baseurl + "/image_maker/file",
data: data + "id=23",
cache: false,
contentType: false,
processData: false,
type: 'POST',
success: function(data){
$(".image_genx").html(data);
}
});
}
</script>
Shouldn’t it be
data is a FormData object , not a string.