The ftp_chmod() function sets the permissions of the specified file on the FTP server.
If successful, the function returns the new permissions. On failure, returns FALSE and a warning.
ftp_chmod(ftp_connection,mode,file)
parameter | describe |
---|---|
ftp_connection | Required. Specifies the FTP connection to use. |
mode | Required. Specify new permissions. The mode parameter consists of 4 numbers: The first number is usually 0 The second number specifies the owner's permissions The third number specifies the permissions of the user group to which the owner belongs The fourth number specifies everyone else's permissions Possible values (to set multiple permissions, total the numbers below): 1 = execute permission 2 = write permission 4 = Read permission |
file | Required. Specifies the name of the file whose permissions are to be modified. |
<?php$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");ftp_login($conn,"user","pass");// Read and write for owner, nothing for everybody elseftp_chmod($conn,"0600","test.txt");// Read and write for owner, read for everybody elseftp_chmod($conn,"0644","test.txt");// Everything for owner, read and execute for everybody elseftp_chmod($conn,"0755","test.txt");// Everything for owner, read for owner's groupftp_chmod($conn,"0740","test.txt");ftp_close($conn);?>