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

154
Visualizações
Vue- Cannot read properties of undefined when dropping file

i am trying to drag and drop an mp3 file into a dropbox on my website. However, when i test it no matter what file i drop i keep getting the same error:

Uncaught TypeError: Cannot read properties of undefined (reading 'files')

This is the dropbox code (made using tailwind and vue):

<div @dragend.prevent.stop="isDragover = false" 
        @dragover.prevent.stop="isDragover = true" @dragenter.prevent.stop="isDragover = true" @dragleave.prevent.stop="isDragover = false" @drop.prevent.stop="upload($event)"
        class="w-[300px] h-[300px] text-gray-400 rounded-md border-2 border-dashed border-gray-300 transition duration-200 ease-linear hover:bg-green-500 hover:text-black" 
        :class="{'bg-green-500 text-black' : isDragover}">
            <p class="font-bold text-center mt-[40%]">Drop your files here</p>
        </div>

this is the method:

methods:{
    upload($event){
        this.isDragover = false;
        const files = [ ...$event.dataTranfser.files];
        files.forEach((file) => {
            if(file.type !== 'audio/mpeg'){
                return;
            }
            const storageRef = storage.ref();
            const songsRef =  storageRef.child(`songs/${file.name}`);
            songsRef.put(file);
        });
       
    },
},

After reading the file i am going to upload it to firebase however the error occurs on this line:

const files = [ ...$event.dataTranfser.files];

The file is somehow unidentified. Thanks for your help in advance

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It may be a spelling mistake. dataTranfser should probably be dataTransfer.

about 4 years ago · Juan Pablo Isaza Relatório
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