+1 vote

Hi

I have downloaded the trial of FTP.

using the following code

 using (Ftp client = new Ftp())
        {
            client.ServerCertificateValidate += ValidateCertificate;

            client.ConnectSSL("mywebsite.co.uk",990);
            client.Login(ftpUsername, ftpPassword);
            string currentFolder = client.GetCurrentFolder();

I can retrieve the currentFolder which equal "/" so I know that I have logged on the the root.

Now I want to change folder to the following path that I see in the FTP program that I normally use to upload files..

/mywebsite.co.uk/wwwroot/QuotaCatchLimits

However when I do

client.ChangeFolder("/mywebsite.co.uk/wwwroot/QuotaCatchLimits");

I get the following exception..The system cannot find the path specified.

I have tried every variant of the folder name I can think of but still end up with the same error. What am I doing wrong.

Once I have that working and I go on to upload a file what exactly would the correct syntax for the client.Upload method be assuming I had a file called myxml.xml on my desktop to be uploaded to the QuotaCatchLimits folder?

Thanks

Dom

by

1 Answer

0 votes

Have you simply tried to change to "mywebsite.co.uk" first:

client.ChangeFolder("mywebsite.co.uk");

You can also use GetList to list all files and folders:

List<FtpItem> items = client.GetList();
foreach (FtpItem item in items)
{
    Console.WriteLine("Name:        {0}", item.Name);
    Console.WriteLine("Is folder:   {0}", item.IsFolder);
}

As for your other question in most servers accept following syntax:

client.Upload(@"folder1\folder2\",@"c:\myxml.xml");
by (301k points)
...