If you want a finished solution, you could look at
https://mohamedrejeb.github.io/Calf/filepicker/
I used it in my KMP-Project for image picking and it seemed pretty solid. If it is not what you're looking for exactly, you can look at the source code of the web implementation. Maybe you'll find what you're looking for there!