Skip to content

Instantly share code, notes, and snippets.

@marifuli
Created February 19, 2022 12:51
Show Gist options
  • Save marifuli/a9e30b9b3342da9d9c7eff799bcbe2ea to your computer and use it in GitHub Desktop.
Save marifuli/a9e30b9b3342da9d9c7eff799bcbe2ea to your computer and use it in GitHub Desktop.
let data = new FormData();
data.append('file', file, file.name);
axios.post(
URL,
data,
{
headers: {
'accept': 'application/json',
'Accept-Language': 'en-US,en;q=0.8',
'Content-Type': `multipart/form-data; boundary=${data._boundary}`,
}
}
)
.then((response) => {
//handle success
})
.catch((error) => {
//handle error
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment