I have the following code in Vue.js and I am trying to upload a file, but my issue is that I want to save the filename of the uploaded file to the JSON API using a POST method. Is there a way to achieve this? Thank you in advance.
<div class="input-file">
<input class="input-file__input" ref="file" type="file">
<div class="input-file__button" @click="selectFile()"></div>
</div>
<script>
selectFile(){
let fileInputElement = this.$refs.file;
fileInputElement.click(); // I want to send this filename to the API POST method
// ...
},
</script>