Following my previous topic about how to drag files out of WebViews, I now want to be able to do the opposite, i.e. drag a file inside the WebView from the DAW or Finder.
I tried to use FileDragAndDropTarget to do this. I’m able to receive the drop event from a JUCE component, but on the WebView it’s not working at all. I guess the issue is that the WebView catches the drop event internally and hence prevents JUCE to detect it.
Another option is to handle the drop from JS, but I want to be able to import binary files, which isn’t supported by Safari.
While I don’t have answers for you, I suspect the file type could be considered irrelevant if you use the drop on the js side to just grab the file path, pass that back to juce and do the actual work in c++ there. Try just get a string out of the web view?
When receiving a drop event in WebViews you can’t know the file path of the input file, you’re just provided with the file content.
It turns out my issue was related to a specific use case, linked to Studio One. It’s possible to retrieve any file content after a drop directly from JS. Here is some example code: