Skip to content

Instantly share code, notes, and snippets.

@SanjayBoricha
Last active August 27, 2019 11:15
Show Gist options
  • Save SanjayBoricha/1b06e164740ff85631369229e330d140 to your computer and use it in GitHub Desktop.
Save SanjayBoricha/1b06e164740ff85631369229e330d140 to your computer and use it in GitHub Desktop.
export const uploadImage = file => dispatch => {
const data = new FormData();
data.append('file', file, file.name);
axios({
method: 'POST',
url: path,
data: data,
headers: {
'Content-Type': `multipart/form-data; boundary=${data._boundary}`
}
})
.then(res => console.log(res))
.catch(e => console.log(e));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment