I'm trying to setup a validation rule on Vuetify's v-file-input
to limit file sizes to 2MB, but the validation incorrectly fails (and the input error appears) when I select files under 2MB.
Excerpt of my Codepen:
<v-file-input
multiple
:rules="rules"
accept="image/jpg, image/jpeg, application/pdf"
placeholder="Pick an avatar"
prepend-icon="mdi-camera"
label="Avatar"
></v-file-input>
<script>
//...
data: () => ({
rules: [
value => !value || value.size < 2000000 || 'Avatar size should be less than 2 MB!',
],
}),
//...
</script>
How do I solve this problem?