I want to be able to upload a text file to Godot. Maybe by dragging and dropping, or maybe using the file explorer. I tried doing this using the JavaScript class in GDScript by doing:
var file_handle = JavaScript.eval("window.showOpenFilePicker();")
This opens the windows file explorer on the top right of my browser. But it prints Null on the chrome console when i do:
print(file_handle)
I'm assuming GDScript doesn't wait until the JavaScript code is finished, it just calls the code and goes to the next line.
In other words: GDScript assigns Null to file_handle because the user didn't upload something yet.
So how could i upload a text file to Godot in a HTML build? I hope someone can help.
Regards