- Home /
C# How to send a string to my FTP server.
RPG rpg = myPlayer.GetComponent<RPG> ();
WWWForm form = new WWWForm();
// The name of the player submitting the scores
form.AddField( "Username", rpg.username );
// The score
form.AddField( "MaxHealth", rpg.maxHealthPoints.ToString() );
// Create a download object
WWW download = new WWW( WhatDoIPutHere, form );
while(!download.isDone){
print (download.progress.ToString());
}
if(download.error!=null){
Debug.Log(download.error);
}
print (download.isDone);
print ("Uploaded");
I have that in a void. What do I put instead of 'WhatDoIPutHere'? I have an FTP server which I can log into in Filezilla. Could someone tell me the format that I input the data from Filezilla into the string? Thanks in advance for all you advanced programmers, Connor. CEO of Radioactive Technologies.
Answer by Uldeim · Nov 22, 2014 at 01:52 AM
From the documentation ( http://docs.unity3d.com/ScriptReference/WWW.html ): "ftp\:// protocol support is limited to anonymous downloads only." Therefore, you can't log in to an FTP server using the WWW class.
You may want to look into FtpWebRequest and FtpWebResponse instead, or one of the many other FTP implementations/libraries available for C#.
Could you please clarify what I should do? I just want to save a players information (all in strings) to an FTP server I have.
@RadioactiveTechnologies: Uhm, are you sure you know what a FTP server is? It uses the File Transfer Protocol which is ment to work with files. The usage of an FTP serer is very limited and you usually don't want to include login information to an FTP server in your game.
To communicate with a server you usually use an HTTP server with a serverside scripting environment like PHP.
I don't know how to use PHP, is there a Unity PHP C# tutorial you can recommend?
Your answer

Follow this Question
Related Questions
Upload to FTP Server 1 Answer
Using an FTP site to store AssetBundles 2 Answers
Web deployment - Is it as easy as this? 1 Answer
Download file from ftp server not work on build release. 1 Answer
Upload game on Google+ 1 Answer