system
December 20, 2016, 10:31pm
1
system
December 21, 2016, 1:54am
4
Reply From:
ingo_nikot
you can download the content of files via the HTTPClient class.
here is an example:
http://codetuto.com/2015/05/using-httpclient-in-godot/
system
December 21, 2016, 2:06am
5
Reply From:
Zylann
I had a try with a different method, there is a specialized function to choose where to put the file. I created a button for testing and an HTTPRequest node as child of it.
Then I added this script on the button:
extends Button
onready var _request = get_node("HTTPRequest")
func _ready():
connect("pressed", self, "_on_button_pressed")
_request.connect("request_completed", self, "_on_request_completed")
func _on_button_pressed():
print("Doing request...")
_request.set_download_file("the_thing.png")
_request.request("http://docs.godotengine.org/en/stable/_static/docs_logo.png")
func _on_request_completed(result, response_code, headers, body):
print("Request completed ", result, ", ", response_code)
However the file arrived partially corrupted, with the following error:
ERROR: DVector<unsigned char>::resize: Condition ' mem.is_locked() ' is true. returned: ERR_LOCKED
At: c:\projects\godot-builds\godot\core\dvector.h:365
When I did it none of the files I tried got corrupted at all.
toivocat | 2021-12-30 18:39
system
December 21, 2016, 9:42am
6
Reply From:
yalondpsi
Thank you, I will check it