sending file and json in POST multipart/form-data request with axios
I am trying to send a file and some json in the same multipart POST request to my REST endpoint. The request is made directly from javascript using axios library as shown in the method below. doAjaxPost() { var formData = new FormData(); var file = document.querySelector('#file'); formData.append("file", file.files[0]); formData.append("document", documentJson); axios({ method: 'post', url: 'http://192.168.1.69:8080/api/files', data: formData, }) .then(function (response) { console.log(response); }) .catch(function (response) { console.log(response); }); } However, the problem is when I