Current Location: Home> Function Categories> ftp_chmod

ftp_chmod

Set permissions on the file via FTP.
Name:ftp_chmod
Category:Uncategorized
Programming Language:php
One-line Description:Set permissions on the file via FTP.

Definition and usage

ftp_chmod() function sets the permissions of the specified file on the FTP server.

If successful, the function returns a new permission. Otherwise, return false.

Example

 <?php
$conn = ftp_connect ( "ftp.testftp.com" ) or die ( "Could not connect" ) ;
ftp_login ( $conn , "user" , "pass" ) ;

// The owner can read and write, and others do not have any permissions
ftp_chmod ( $conn , "0600" , "test.txt" ) ;

// The owner can read and write, and others can read
ftp_chmod ( $conn , "0644" , "test.txt" ) ;

// The owner has all permissions, which can be read and executed by others
ftp_chmod ( $conn , "0755" , "test.txt" ) ;

// The owner has all permissions, and the group to which the owner belongs can be readable
ftp_chmod ( $conn , "0740" , "test.txt" ) ;

ftp_close ( $conn ) ;
?>

grammar

 ftp_chmod ( ftp_connection , mode , file )
parameter describe
ftp_connection Required. Specifies the FTP connection to be used (the identifier of the FTP connection).
mode Required. Specify new permissions.
file Required. Specifies the name of the file to be modified.
Similar Functions
Popular Articles