ftp_connection::chmod

Description

Chmods the specified file to the specified value.

Syntax

bool ftp_connection::chmod (string $ftp_file, int $chmod)



Parameter $ftp_file

Expected type: String
Description: The name of the file/folder to chmod



Parameter $chmod

Expected type: Integer
Description: The desired chmod value (example: 0777)



Return value

Expected type: Boolean
Description: True if the command was successful, false otherwise


Notes

  • Example: $package_ftp->chmod('myfile.txt', 0666);
  • Sends the SITE CHMOD command to the FTP server
  • Converts $chmod from octal (0777) to text ("777")
  • Checks for a valid connection before continuing
  • Checks for a 200 response code (Command ok).
  • Sets a 'bad_file' error if the command wasn't successful
  • Returns false if there wasn't a valid connection or the command was unsuccessful
Advertisement: