I am using Mongoose 6.18 version as an Embedded Web Server for my project. I have an issue when I try to upload a file to the server. I have a react application on the front end that uses axios api with formdata to send the file. ``
await axios.post("http://" + window.location.host + "/upload", data, {
headers: {
"Content-Type": "multipart/form-data",
"Content-Length": ""
}
}).then((response) => {
console.log(response);
console.log(response.data.message);
alert("File Upload successful");
}, (error) => {
console.log(error);
alert("File Upload not successful");
});
On the server side I am using multipart handling as mentioned in this link. I use the function mg_file_upload_handler. https://cesanta.com/blog/big-upload-example-mongoose-more-than-an-embedded-web-server-2/
By connection closes when the multipart chunks are in progress and every time only a part of file is uploaded. Can someone pls guide me in this.