I have a XMLHttpRequest:
chat.sendMessage = function (message) {
var xhr = new XMLHttpRequest();
xhr.open("POST", options["url"], true);
console.log(message["image"]);
xhr.send(JSON.stringify(message));
};
As you see I log image field directly before sending message. And the log writes File object in a console. But on the server side this field is empty. Why?
This is a function where I attach image to image field:
imageAddWindowSubmit.onclick = function () {
...
message.addImage(chatInputImage.files[0] || "");
if (message["text"] || message["image"]) {
chat.sendMessage(message);
}
};
AddImage method:
this.addImage = function (image) {
this.image = image;
};