Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

185
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!