fixup for c02e0b82bc
This commit is contained in:
parent
68dd88940e
commit
b4a44124b7
31
form/res-judicata/src/views/Upload.vue
Normal file
31
form/res-judicata/src/views/Upload.vue
Normal 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>
|
Loading…
Reference in New Issue
Block a user