Allow selecting both directories and files for upload
See original GitHub issueIs your feature request related to a problem? Please describe.
My users need to be able to select both directories and files for uploads. This sadly can’t be done with in one go because setting the webkitdirectory
attribute disables the selection of single files (at least in Chrome on macOS). The best approach I found is providing the user with two buttons: a “upload files” and “upload directory” one. Then call .showFileUpload()
from their click handler after setting the webkitdirectory
attribute to respectively false
or true
on the file input. However, this is slightly complicated because there’s no reference to this input available.
Describe the solution you’d like
Make the fileInputRef
available in the UploadyContext
.
Describe alternatives you’ve considered
Have .showFileUpload()
apply the webkitdirectory
option (and also e.g. the multiple
one) before calling input.click()
. Or even add a .showDirectoryUpload()
method that does the same.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
@mart-jansink maybe I am missing something, but I am able to drag and drop complete nested directories onto the d&d component. Did have to provide these settings:
htmlDirContentParams={{ recursive: true, withFullPath: true}}
@mart-jansink im conflicted over exposing a ref to the internal input. Im not sure if in the long run it will be good to have that part of the public API. That is why I allowed handing a custom input from the outside for advanced use-cases that are a small fraction of what users typically require. I’ll keep this in mind and think about whether its something to add in the future.
For now Ill move this issue to the discussions section for others to see.