Files not uploading to remote server with Net_SFTP

前端 未结 1 683
时光取名叫无心
时光取名叫无心 2021-01-26 15:32

I have the following class for uploading files in a directory, however, the first directory that should be created is getting set up as \'File\' rather then a \'File Folder\'. B

1条回答
  •  一整个雨季
    2021-01-26 16:00

    It works for me. I tried $sftp->mkdir('Test folder') and $sftp->mkdir('./Test folder/Another folder'). The directories that were created were created as expected.

    One thing to keep in mind... DIRECTORY_SEPARATOR is probably not the best thing to use in this instance. On Windows, for example, DIRECTORY_SEPARATOR is \ - not /. This is an issue because the SFTP specs say that directories are to be represented with / - not . Quoting draft-ietf-secsh-filexfer-02:

    This protocol represents file names as strings. File names are assumed to use the slash ('/') character as a directory separator.

    I guess to have further insight a copy of the SFTP logs would be helpful. Maybe just provide the SFTP logs of a mkdir operation. You can get the SFTP logs by doing define('NET_SFTP_LOGGING', 2) at the top and then doing echo $sftp->getSFTPLog() after the mkdir.

    0 讨论(0)
提交回复
热议问题