Quantcast
Channel: Chilkat Forum - latest questions
Viewing all articles
Browse latest Browse all 1061

Chilkat shows file upload successful but getting 500 Syntax error , Command unrecognized in FTPS Log

$
0
0

Using Chilkat File uploaded showing successful. But when file has been actually uploaded in the FTPS server. FTPS server log it shows "500 syntax error, command un-recognized".

Below is the Code Snippet used for uploading the File -

Chilkat.Ftp2 ftp = new Chilkat.Ftp2();

            bool success;

            //  Any string unlocks the component for the 1st 30-days.
            success = ftp.UnlockComponent("Anything for 30-day trial");
            if (success != true)
            {
                Console.WriteLine(ftp.LastErrorText);
                return ftp.LastErrorText;
            }

            //  If this example does not work, try using passive mode
            //  by setting this to true.
            ftp.Passive = true;
            ftp.Hostname = parameters.HostName;
            ftp.Username = parameters.UserName;
            ftp.Password = parameters.Password;
            ftp.Port = 20017;

            //  We don't want AUTH SSL:
            ftp.AuthTls = false;

            //  We want Implicit SSL:
            ftp.Ssl = true;

            //  Connect and login to the FTP server.
            success = ftp.Connect();
            if (success != true)
            {
                Console.WriteLine(ftp.LastErrorText);
                ftp.Disconnect();
                return ftp.LastErrorText;
            }
            else
            {
                //  LastErrorText contains information even when
                //  successful. This allows you to visually verify
                //  that the secure connection actually occurred.
                Console.WriteLine(ftp.LastErrorText);
                Console.WriteLine("FTPS Channel Established!");

                success = ftp.ChangeRemoteDir("/");
                if (success != true)
                {
                    return ftp.LastErrorText;//Directory Change Error.

                }
                else
                {

                    ftp.PassiveUseHostAddr = true;
                    success = ftp.PutFile("C:\\Test\\test.txt", "test.txt");

                    if (success != true)
                    {
                        //ftp.Disconnect();
                        return  "---------Upload Error  --------- " + ftp.LastErrorText + "---" ;//Upload Error.
                    }
                    else
                    {
                        ftp.Disconnect();
                        return "File Uploaded sucessfully.";
                    }

                }
            }

Viewing all articles
Browse latest Browse all 1061

Trending Articles