$("#sendBtn").click(function () {
var file = $("#preview_img")[0].files[0];
var reader = new FileReader();
reader.onload = function (event) {
var buffer = new Uint16Array(event.target.result);
w.send(JSON.stringify({
title: articleTitle.val().toString(),
content: CKEDITOR.instances['editor'].getData(),
preview_img: buffer,
img_name: file.name
}));
console.log(event.target.result)
};
reader.readAsArrayBuffer(file);
});
msg_file = {
name: file[0].files[0].name,
file: file[0].files[0]
}
sock.send(JSON.stringify(msg_file));
WSMessage(type=<WSMsgType.TEXT: 1>, data='{"name":"Screenshot from 2016-10-01 12:38:27.png","file":{}}', extra='')
var file = $('#data');
if(file != undefined){
sock.send(file[0].files[0]);
}