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.
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.