PHP: Copying file permissions with fileperms and ftp_chmod -


Total goal: Copy files permissions from the local file system when uploading them to FTP using PHP.

Problem: While ftp_chmod appears to be successful, and according to the print statement in the code I am setting correct permissions, it sets completely false permissions.

Code:

  & lt ;? Php $ perms = fileperms ($ src); If ($ perms! == false) {// We only take the last 3 digits, since we are only interested in 'normal' file permissions, not extended $ Perms & amp; = 511; $ Permsm = sprintf ('% o', $ perms); Print "Debugs: Settings Permissions: $ perms ::". Decoct ($ perms) ":: $ permsm :: $ dst \ n"; Ftp_chmod ($ conn_id, $ permsm, $ dst); }? & Gt; Result: Source / Expected file permissions (local file system): 

 -R-R - R - 1 Allen user 15572 Jun 2 12:40 ft .docx -rw-r - r-- 1 Allen user 16877 Jun 2 12:40 baradox dow x r-xr-x2 allen user 4096 Jun 15 14:01 Configuration DWXR-XR-N 9 Allen user 4096 15 Jun 14: 01 Material drwxr -xr-x3 Allen user 4096 Jun 15 14:01 Local -R-R-R1 Allen user 152274 Jun 11 17:13 foo1.sql -rw-r - r-- 1 Allen users 9984 2 Mar 10:44 footest.sql drwxrwxrwx 2 Ellen user 4096 15 Jun 14:01 TMP drvaxr-xr-x3 allen user 4096 Jun 15 14:01 version 

Destination / real result file permissions ( FTP upload):

 - w ---- rt 1 ftptest ftptest 15572 15 Jun 14:42 Foo.docx - w ---- RT 1 ftptest ftptest 16877 15 June 14:42 Docx d- Wxrw - wt 2 ftptest ftptest 4096 Jun 15 14:42 Configuration DWoxRW - WT9 OptatureFestest 4096 Jun 15 14:42 Content DWWWWT wt ftptest ftptest 4096 Jun 15 14:42 s Local - - - - RT1 eftextestaptifst 152274 Jun 15 14: 4 2 foo1.sql - w ---- rt 1 ftptest ftptest 9984 15 Jun 14:42 footest.sql dr ---- x - t 2 Ftptest ftptest 4096 15 june 14:42 tmp d-wksrw-wt 3 ftptest ftptest 4096 Jun 15 14:42 version 

Pass the $ perms $ ftp_chmod, $ permsm no


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -