Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

288
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda