This commit is contained in:
Vojtěch Káně 2021-01-23 06:49:07 +01:00
parent 68dd88940e
commit b4a44124b7

View File

@ -0,0 +1,31 @@
<template>
<div>
<form action="." method="POST" enctype="multipart/form-data" @submit.prevent="processForm">
<input id="file" type="file" name="file">
<input type="submit" value="Submit">
</form>
</div>
</template>
<script>
// @ is an alias to /src
export default {
name: 'Upload',
methods: {
processForm: function () {
const formData = new FormData();
formData.append("file", document.getElementById("file").files[0]);
fetch("http://localhost:5000/validator", {method: "POST", body: formData})
.then(response => response.json())
.then(result => {
console.log(result);
})
.catch(err => {
alert(err); //TODO
})
},
},
}
</script>