Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

287
Views
Vue 3 + Vee Validate file input validation

I'm trying to validate my file input (type image) but I got this error:

Uncaught (in promise) DOMException: Failed to set the 'value' property on 'HTMLInputElement': This input element accepts a filename, which may only be programmatically set to the empty string.

Template:

  <q-btn
          color="primary"
          outline
          label="Upload Avatar"
          @click="fileInputRef && fileInputRef.click()"
        />
        <input
          ref="fileInputRef"
          type="file"
          name="file"
          class="hidden"
          :value="avatar"
          @change="
            avatar = $event.target.files.length
              ? $event.target.files[0]
              : undefined
          "
        />

Script:

    const { value: avatar } = useField('avatar');
    const fileInputRef = ref<HTMLInputElement>();

Note: when I check Vue developer tools, avatar property set and I have selected file in my code but that error will show on console.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!