Nick Poulos
1 min readNov 25, 2019

--

Wow that seems like an awful lot of code/explanation for such a simple task?

upload(files) {
const config = {
'Content-Type': 'multipart/form-data',
onUploadProgress: function(progressEvent) {
var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total)
console.log(percentCompleted)
}
}
let data = new FormData()
data.append(‘file’, files[0]) // or any other blob
axios.put(‘/endpoint/’, data, config)
.then(res => console.log(res))
.catch(err => console.log(err))
}

--

--

Nick Poulos
Nick Poulos

Responses (1)