Archived Forum Post

Index of archived forum posts

Question:

Failed to open file (2)

Apr 29 '14 at 10:47

When I upload files via the SFTP method some files will upload with no issues and then a file will fail. I validated that the file does exist in the local directory. Here is the Chilkat log results of the upload. I was using an older dll prior to trying to figure this out. Same error results with the new dll.

ChilkatLog:
  UploadFile:
    DllDate: Apr 24 2014
    ChilkatVersion: 9.5.0.34
    UnlockPrefix: CALKINSSH
    Username: CORPWEB:Administrator
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 0
    SshVersion: SSH-2.0-SFTP
    SftpVersion: 3
    handle: 4B30486E6833
    fromPath: D:\Current\WWSB\FHP looks at sudden acceleration in daycare crash.xml
    uploadFile:
      socketOptions:
        SO_SNDBUF: 8192
        SO_RCVBUF: 8192
        TCP_NODELAY: 1
      --socketOptions
      handle: 4B30486E6833
      fromLocalPath: D:\Current\WWSB\FHP looks at sudden acceleration in daycare crash.xml
      Failed to open file (2)
      localFilePath: D:\Current\WWSB\FHP looks at sudden acceleration in daycare crash.xml
      currentWorkingDirectory: C:\Program Files\Microsoft Visual StudioVB98
      osErrorInfo: The system cannot find the file specified.
      localWindowsFilePath: D:\Current\WWSB\FHP looks at sudden acceleration in daycare crash.xml

This happens randomly. Sometimes all files will upload, sometimes just 4 or 5. This is a rather new problem since this has been running for years. One caveat, the main core of our network was upgraded recently to a gigabyte core bandwidth. Any ideas? Mike


Answer

The error here has nothing to do with SSH/SFTP. The error is that the local file you are trying to upload does not exist. (In other words, if the local file to be uploaded cannot be found and opened, the method call fails before anything pertaining to SSH/SFTP happens.)

Chilkat provide all possible information about the file open failure in the LastErrorText. It provides the exact path, and it also provides the current working directory just in case the path is a relative path. The "osErrorInfo" is what is returned by the system function all to open the file. In the case of Windows, this would be the "CreateFile" Platform SDK function. ( see http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858%28v=vs.85%29.aspx ) There really isn't any more information that can be provided. In other words -- trust the error message: the file is not there.