Hi, this is my first post here. I have been playing with Godot for a few days now and i am super impressed even if it is a bit over my head. I am building a html5 project and want the user to be able to load files from the local filesystem. I can do this with the following code
extends Control
func _on_Button_pressed():
var content = JavaScript.eval("""
var input = document.createElement('input');
input.type = 'file';
input.onchange = e => {
var file = e.target.files[0];
var reader = new FileReader();
reader.readAsText(file,'UTF-8');
reader.onload = readerEvent => {
var filecontent = readerEvent.target.result; // this is the content!
}
}
input.click();
""")
My problem is how to get the data in to a variable that godot can use.