Skip to content

Instantly share code, notes, and snippets.

@wanmigs
Created April 29, 2019 02:05
Show Gist options
  • Save wanmigs/3a3a56bfd3e94279986c02ec46d81698 to your computer and use it in GitHub Desktop.
Save wanmigs/3a3a56bfd3e94279986c02ec46d81698 to your computer and use it in GitHub Desktop.
Fix Formdata on Patch Laravel
let data = new FormData();
data.append("_method", 'PATCH');
// append another data ....
const headers = {
'Content-Type': 'multipart/form-data',
'enctype' : 'multipart/form-data',
'Authorization' : 'Bearer ' + token
}
axios({
method : "POST",
baseURL: this.baseURL,
url : url,
params : params,
data : data,
headers: headers,
}).then(response => {
return response
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment