0

In general i want that every 5 minutes my application will upload a text to my website. So if the current page in my website is empty after uploading the text i will see on the page the text.

This is my example website:

http://rhodan.wix.com/chocolade#!blank/c1236

Empty page.

This is the code I'm trying to use to upload the text to the site:

private void SaveTToWeb()
        {
            try
            {
                WebClient client = new WebClient();
                string myFile = @"C:\Temp\file.txt";
                client.Credentials = CredentialCache.DefaultCredentials;
                client.UploadFile(@"http://rhodan.wix.com/chocolade#!blank/c1236", "PUT", myFile);
                client.Dispose();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }

I don't get any exceptions or errors but i don't see the text in the text file on my page.

Ed Power
  • 8,310
  • 3
  • 36
  • 42
user3200169
  • 275
  • 4
  • 17

1 Answers1

1

When uploading a file to remote server, one must ask himself couple of question.
Does the remote server support it ?
How do you communicate with the remote host (HTTP, FTP, REST API) ?
I see that you write "PUT", does wix support what you are trying to do ?
In addition, you would probably need credentials (username/password/key) in order to upload a file to a specific remote server.
From quick reading, I see you should upload the files via FTP.
http://www.wix.com/support/forum/flash/other/other/accessing-my-server-for-upload-of-files
And here's a link might be useful
FTP client in C#

Community
  • 1
  • 1
ilansch
  • 4,784
  • 7
  • 47
  • 96