Im trying to send data like string or even files to server via jquery ajax. Strings are appending to that FormData() but not files. I don't know why! Here is what I'm trying:
var dataFiles = new FormData();
dataFiles.append('file', $('#file-' + boardId)[0].files[0]);
dataFiles.append('boardId', boardId);
dataFiles.append('_token', $('meta[name="csrf-token"]').attr('content'));
dataFiles.append('message', encodeURIComponent(message));
$.ajax({
method: "POST",
type: "POST",
url: url,
data: dataFiles,
cache: false,
contentType: false,
processData: false,
}).done(function (msg) {});
Edit: That file exist, I checked that too in console.log()