$("#sendBtn").click(function () {
var file = $("#preview_img")[0].files[0];
var fileReader = new FileReader();
fileReader.readAsBinaryString(file)
w.send(JSON.stringify({
title: articleTitle.val().toString(),
content: CKEDITOR.instances['editor'].getData(),
preview_img: fileReader.result, <-------
img_name: file.name
}));
});
Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
This method has been removed from the FileAPI standard. FileReader.readAsArrayBuffer() should be used instead.