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

188
Visualizações
Drag and Drop empty folders with React-dropzone

I am working on a folder uploading project and using React-dropzone for that.

however when I drop a folder and the folder does not contain anything then acceptedFiles stays empty. I have noticed acceptedFiles, each file object contains a "path" attribute which gives the location, that's because react-dropzone uses the file-selector library.

const onDrop = useCallback((acceptedFiles) => {console.log(acceptedFiles)}

but according to the DOC I can create a custom made drop event which can detect if a folder was dropped (even if its empty) const {getRootProps, getInputProps, isDragActive} = useDropzone({onDrop, getFilesFromEvent: event => myCustomFileGetter(event)})

Does anyone know how can I generate a path for my empty folder structure? It's an issue because if I'm dropping a folder with multiple child folders just only those folder gets detected by file-selector which has a file in it.

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

0

It seems that the library that it uses looks for files to upload, and if there are no files in a folder, then it doesn't upload the folder. This comes from the idea that "Why would you need to upload an empty folder?" when uploading the files themselves.

This is a limitation with the file-selector library itself, so it might be a better idea to find another solution to the problem.

https://github.com/react-dropzone/react-dropzone/issues/934

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