Subject: Re: sftp upload file path

Re: sftp upload file path

From: Peter Stuge <>
Date: Mon, 7 Jan 2019 16:30:49 +0000

William Shipley wrote:
> What is the best practice approach for uploading a path with
> sub-directories that may not exist?

I'd suggest using libssh2_sftp_mkdir() to try to create the
directory, ignoring errors, then optionally _stat() to validate
permissions and _chmod() to correct them, finally _open() the file.

You'll have to handle one directory at a time. There is no -p.

Received on 2019-01-07