score:1

Accepted answer

you can use axios and form data for that

const myformdata = new formdata();

myformdata.append('files', 'file');

you can add another properties like name or whatever too

myformdata.append('name', 'myfilename');

then use the axios

axios({
  method: "post",
  url: "myurl",
  data: myformdata,
  headers: { "content-type": "multipart/form-data" },
})
  .then(function (response) {
    //handle success
    console.log(response);
  })
  .catch(function (response) {
    //handle error
    console.log(response);
  });

Related Query

More Query from same tag