PHP ftp_chmod() Function

PHP FTP Reference : Set file permissions

Definition and Usage

The ftp_chmod() function sets permissions on the specified file via FTP.

Syntax

ftp_chmod(ftp_conn, mode, file);

Parameter Values

Parameter Description
ftp_conn Required. Specifies the FTP connection to use
mode Required. Specifies the new permissions.

This parameter consists of four numbers:

  • The first number is always zero
  • The second number specifies permissions for the OWNER
  • The third number specifies permissions for the OWNER's USER GROUP
  • The fourth number specifies permissions for EVERYBODY ELSE

Possible values (to set multiple permissions, add up the following numbers):

  • 1 = execute permissions
  • 2 = write permissions
  • 4 = read permissions
file Required. Specifies the file to set permissions on

Technical Details

Return Value: The new file permissions on success, FALSE on failure
PHP Version: 5+

❮ PHP FTP Reference