I want to generate a string base64 with a input type=file to persist just the string base64 so that became easier to manage images in database. Easier because i can work with only Json in this way.
I have something like this in my Vue server (using bootstrap-vue):
<template>
<div class="row">
<!-- Send Image -->
<div class="col-sm-8 ml-auto mr-auto">
<b-form-file v-model="file" :state="Boolean(file)" placeholder="Escolha uma imagem..." accept="image/*"></b-form-file>
<b-button v-on:clicl="submitFile()">Enviar</b-button>
</div>
</div>
</template>
export default {
name: 'imagem',
data(){
return{
file: ''
}
},
methods:{
submitFile () {
let stringBase64 = wantToConvertFile(this.file);
}
}
}
So how is the simple way to make sometring similar of "wantToConvertFile( )"?