login about faq

Hi,

I am working on an application where I use SFTP and for uploading I am using the WriteFileBytes function as I am working with streams.

I need to be able to upload files where the path does not always exists and even though that I adds createTruncate as createDisposition it fails with an error that the file does not exist.

My guess is that it is becourse the path does not exist.

So my question is:

What would be the best approach to handle this.

Should I always call the CreateDir function first even that the path exist or how should I handle it?

Thanks,

Hendrik

Example of an error text:

ChilkatLog:
  OpenFile:
    DllDate: Aug 28 2012
    UnlockPrefix: HNDJNSSSH
    Username: HENDRIK-PC:Hendrik
    Architecture: Little Endian; 64-bit
    Language: .NET 4.5 / x64
    VerboseLogging: 0
    SshVersion: SSH-2.0-OpenSSH_4.3
    SftpVersion: 3
    filename: store/ariel/events/records/2013/1/1/0/events~27_0~c2c36bac4991454f~9c23d7f2b57f8bd1~0
    access: writeOnly
    createDisposition: createTruncate
    v3Flags: 0x1a
    Sent FXP_OPEN
    StatusResponseFromServer:
      Request: FXP_OPEN
      InformationReceivedFromServer:
        StatusCode: 2
        StatusMessage: No such file
      --InformationReceivedFromServer
    --StatusResponseFromServer
    retryFilepath: ./store/ariel/events/records/2013/1/1/0/events~27_0~c2c36bac4991454f~9c23d7f2b57f8bd1~0
    filename: ./store/ariel/events/records/2013/1/1/0/events~27_0~c2c36bac4991454f~9c23d7f2b57f8bd1~0
    access: writeOnly
    createDisposition: createTruncate
    v3Flags: 0x1a
    Sent FXP_OPEN
    StatusResponseFromServer:
      Request: FXP_OPEN
      InformationReceivedFromServer:
        StatusCode: 2
        StatusMessage: No such file
      --InformationReceivedFromServer
    --StatusResponseFromServer
    Failed.
  --OpenFile
--ChilkatLog

asked Feb 03 '13 at 16:24

H_Johns's gravatar image

H_Johns
16334


Yes, the SSH/SFTP server is not automatically creating the directories that might not exist in the path. Your app would need to explicitly do it.

link

answered Feb 04 '13 at 10:41

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

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:

×200
×50

Asked: Feb 03 '13 at 16:24

Seen: 1,148 times

Last updated: Feb 04 '13 at 10:41

powered by OSQA