Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENHANCEMENT] Browse folders #1344

Open
NotYoojun opened this issue Feb 25, 2024 · 6 comments
Open

[ENHANCEMENT] Browse folders #1344

NotYoojun opened this issue Feb 25, 2024 · 6 comments

Comments

@NotYoojun
Copy link

Is your feature request related to a problem? Please describe.
I'm building a coud drive client. And I use this lib for uploading the files. However it seems that the dialog can only select files, not folders.

image

Describe the solution you'd like
I hope there is a property, indicating whether clicking the drop zone will open a file select dialog or a folder select dialog.
I think this is totally possible because there are certain APIs for HTML already.

Additional context

What a file selector dialog looks like:

image

While a folder selector dialog looks like:

image

@abdullahIsa
Copy link

Anyone has solution to this ?

@demarchenac
Copy link

@abdullahIsa On #1157 there's a workaround to select folders, but for some reason it doesn't allows files

@abdullahIsa
Copy link

#1157

thanks.

@demarchenac
Copy link

@abdullahIsa You would need to process the folder files separately it seems that you could pass down the getFilesFromEvent taking into account your useCase for Folder uploads or File uploads

@abdullahIsa
Copy link

@abdullahIsa You would need to process the folder files separately it seems that you could pass down the getFilesFromEvent taking into account your useCase for Folder uploads or File uploads

thanks for this but dont fully get it, do you meant like this ?
<Dropzone ref={dropzoneRef}> {({getRootProps, getInputProps, getFilesFromEvent}) => ( <div {...getRootProps(), ...getFilesFromEvent()}> <input {...getInputProps(), ...getFilesFromEvent()} /> <p>Drag 'n' drop some files and folders here, or click to select files and folders</p> </div> )} </Dropzone>

@demarchenac
Copy link

Hi @abdullahIsa, taking into account my tests with this behavior you would need to play around with the hook to handle this scenario properly. I've found out that if you pass useFsAccessApi as true, then you would need to add your own custom getFilesFromEvent handler since the default one only works for file uploads and not for folder uploads through the Folder Picker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants