'file upload using axios in react

I am uploading file in react using axios. when I am doing

alert(values.attachedFile[0]);

enter image description here

but when I am sending values.attachedFile[0] in axios post request enpty thing is going.

  const { result } = await axios.post(app.resourceServerUrl + '/file/upload', {
        data: values.attachedFile[0],
        headers: {
            'Content-Type': 'multipart/form-data',
        },
    });

but as part of request is is going empty.

enter image description here

what mistake I am doing?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source