Hi there I need to be able to save and load to a file in a FTP server and i know how to do this in VB onside visual studio and i know how to use FPaths to save a string to a file and load it back again in the game but I need help saving a file to a URL like www.myserver.com/myfile.txt I need to load and save to a FTP URL like that but I typed a URL in the location but it doesn’t work. Only works with files on a harddrive on my PC so can anyone please help me to log into a FTP server and read and write files in C++ please
Thanks
UE4 API does not support FTP, you need to do so via external library, or talk with FTP server via sockets.
HTTP on other hand is supported and i think it’s better idea Here you API refrence to HTTP module
This is entry point:
Create a http request:
I returns request body which you can edit with those functions:
Request is processed asynchronously so it does not lock the thread waiting for response from server, thats why you need to bind event which be called when responce been recived:
Once you set up the request you call ProcessRequest and HTTP module with do the rest:
And once it got reponce it will call function you binded with IHttpReponce argument from which you can read reponce data:
Here you have nice simple example from engine source code how to use it (Note how OnProcessRequestComplete function arguments, your function needs to be exactly the same, only name can be different):
And lastly if you gonna use HTTP module, remember to add “HTTP” in to depency in build scipt same as you do with “AIModule”, otherwise you gonna have linker errors