0👍
The problem is with how you upload files using ajax.
The generally recommended way to do it is to use FormData.
I am able to get it to work without having Illegal invocation
error in https://jsfiddle.net/jacobgoh101/p6yuzm26/12/ .
handleSubmit: function(e) {
var vm = this;
var form = $('#addForm form')[0];
var data = new FormData(form);
$.ajax({
url: 'http://localhost:4000/s/',
data: data,
type: 'POST',
//dataType: 'json',
enctype: 'multipart/form-data',
processData: false,
contentType: false,
cache: false,
success: function(e) {
// ...
}
});
return false;
},
This is the reference that I followed => https://coderwall.com/p/p-n7eq/file-uploads-with-jquery-html5-and-formdata .
Hope this helps.
Source:stackexchange.com