FTP upload in Editor script not working

Dear all,

I’ve been struggling to get the following FTP upload working [EDIT: in Editor script]. I’m receiving “System.Net.WebException: Server returned an error: Invalid response from server” error. Using Unity 2017.1.0b8. Do you see any apparent problem in the code bellow, please?

[EDIT: Or should I ask: “Is this piece of code working for you?”]

            var localFile = @"C:\Users\user\Downloads\test.txt";
            var remoteFile = "test.txt";
 
            WebClient client = new System.Net.WebClient();
            client.Credentials = new System.Net.NetworkCredential("username", "password");
            try
            {
                client.UploadFile(new Uri("ftp://address/" + remoteFile), null,
                    localFile);
            }
            catch (Exception ex)
            {
                Debug.LogError(ex.ToString());
            }

I have the same problem I think unity might do some networking stuff different so ftp might not be possible in Unity…
I also think not enough people WANT to do file transfer so they probably wont fix it soon (IF IT IS a problem with unity)
Hit me up if you have a solution though! so will I…

Okay I got it working, if anyone else has the same problem:

  1. Go to your player settings
  2. Under ‘Other Settings’
  3. set ‘Scripting Runtime Version’ to ‘.NET 4.x Equivalent’
  4. restart Unity
    should work now