0๐
<input id="file-upload" type="file" />
and in Vue Methods you create an async function that sends the request.
let file = document.querySelector("#file-upload").files[0];
const formData = new FormData();
formData.append("binFile", file);
try{
let res = await axios.post('<enpoint upload url>', formData, {
headers: { "Content-Type": "multipart/form-data" }
});
}
catch(e){
//in case await fails(4xx,5xx error)
}
Source:stackexchange.com