Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

116
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda