Closed yo35 closed 8 months ago
You can use the chmod() command to change the permissions on files/folders after upload. There is no mechanism to do this during or as part of the upload.
Many sftp servers (if using a real sftp server) also provide functionality to force specific file modes or ownership for uploaded files and in some situations, you can do things like setting the sticky bit on remote parent directories so that uploaded files inherit specific modes etc (dependent on remote platform and file system of course).
OK, thanks. The workaround with chmod()
will do the job, but it would be nice if it were possible to manage the file/folder permissions with method uploadDir(..)
as simply as with method put(..)
.
I won't be adding such a feature.
The goal of this library was to provide a low level API which could be used to implement basic sftp functionality. Adding the uploadDir/downloadDir was even borderline and I'm still unsure if it was a good idea as it has created significantly more complexity and maintenance.
However, the main reason is that there isn't any easy way of adding it that wouldn't just involve an additional call to perform a chmod() after each file/dir upload/download. This would be a performance hit and we woulud need to add additional code to make it optional, adding further complexity. Then once it is added, I'm sure someone would ask for the ability to set ownership etc.
The library provides all the low level functionality needed to implement your own uploadDir/downloadDir. You can even use the existing code as a template and just add the chmod call, creating your own version of upload/Downld dir.
Hi, Is there a way to set the file/folder permissions when using
uploadDir(..)
?