login about faq

I am using FTP using TLS i.e., FTPS. I am trying to upload file from my local using FTPS. Getting Can't find file error though the file is present in physical location.

Code Snippet -

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 = false;
            ftp.Hostname = parameters.HostName;
            ftp.Username = parameters.UserName;
            ftp.Password = parameters.Password;
            ftp.Port = 20017;

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

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

            //  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
                {
                    string localfilename = "c:/temp/test.txt";
                    string remotefilename = "test.txt";

                    success = ftp.PutFile(localfilename, remotefilename);

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

                }
            }

I am getting below error -

---------Upload Error --------- ChilkatLog: PutFile: DllDate: Aug 30 2017 ChilkatVersion: 9.5.0.69 UnlockPrefix: Anything for 30-day trial Architecture: Little Endian; 32-bit Language: .NET 4.5 VerboseLogging: 0 RemoteFilename: test.txt LocalFilename: c:/temp/test.txt ProgressMonitoring: enabled: yes heartbeatMs: 0 sendBufferSize: 65536 --ProgressMonitoring IdleTimeoutMs: 60000 ReceiveTimeoutMs: 60000 ConnectTimeoutSeconds: 30 soRcvBuf: 4194304 soSndBuf: 262144

Failed to open file (3)
utf8Filename: \\?\c:\temp\test.txt
osErrorInfo: The system cannot find the file specified.
localWindowsFilePath: c:\temp\test.txt
Failed to get local file size.
localFilePath: c:/temp/test.txt
Percent done event callbacks are disabled for this call.
uploadFromLocalFile:
  Failed to open file (3)
  utf8Filename: \\?\c:\temp\test.txt
  osErrorInfo: The system cannot find the file specified.
  localWindowsFilePath: c:\temp\test.txt
  Failed to open file data source.
--uploadFromLocalFile
TotalTime: Elapsed time: 0 millisec
Failed.

--PutFile --ChilkatLog


asked Sep 26 at 22:25

Sabari%20Ghosh's gravatar image

Sabari Ghosh
1


Try in UNC format: "c:\temp\test.txt"

Added a image, because the forum don't show the UNC path when it's posted here. alt text

link

answered Sep 27 at 00:15

Vinnie's gravatar image

Vinnie
112

edited Sep 27 at 00:20

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×8

Asked: Sep 26 at 22:25

Seen: 129 times

Last updated: Sep 27 at 00:20

powered by OSQA