Created
November 7, 2019 02:57
-
-
Save ambrizals/e44ea9afb5adc875bd0500afe8cb6e61 to your computer and use it in GitHub Desktop.
Code yang menggunakan form-data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
updateArticle(){ | |
this.updateCover = false | |
let formData = new FormData() | |
formData.append('cover_article', fs.createReadStream(this.imgCover.path)) | |
axios.post('https://www.example.com/atk/posts/cover/'+this.params, formData, { | |
headers: { | |
'Access-Control-Allow-Origin': '*', | |
'Content-Type': 'multipart/form-data', | |
'Authorization' : 'Bearer ' + storageService.getToken() | |
} | |
}).then((res) => { | |
console.log(res.response) | |
}).catch((err) => { | |
console.log(err.response) | |
}) | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment