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

111
Vistas
Vuejs with upload file

I'm trying to upload images with Vue Js, but it didn't work. If you examine the codes below, you will see that I cannot transfer the file correctly. I couldn't find where the problem originated.

I am requesting your support.

// HTML code
// There is a problem in the image or file upload area to the card.
<input type="file" v-model="cardContent.cardContentImgPath" @change="onFileChange">

// Vuejs code
onFileChange(e) {
        var files = e.target.files || e.dataTransfer.files;
        console.log(e.target.files);
        if (!files.length)
            return;
        this.addToCardContent(files[0]);
      },

      addToCardContent: function(file){
        
        let formData = app.toFormData(app.cardContent, file);

        
        axios.post('https://example.com/note/api_card.php?action=addContent',formData, {
            header:{
                'Content-Type' : 'multipart/form-data'
            }})
        .then(function(response){
            if(!response.data.error){

                app.getListCardContent();
                console.log(app.cardContent.cardContentImgPath);
                app.cardContent     = {cardContentText : '', cardContentImgPath : ''};

            }
        });



      }
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