THE WORLD'S LARGEST WEB DEVELOPER SITE

PHP ftp_site() Function

PHP FTP Reference PHP FTP Reference

Example

Send an FTP SITE command:

<?php
// connect and login to FTP server
$ftp_server = "ftp.example.com";
$ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);

// try to send SITE command
if (ftp_site($ftp_conn, "chmod 777 serverfile.txt"))
  {
  echo "Command executed successfully";
  }
else
  {
  echo "Command failed";
  }

// close connection
ftp_close($ftp_conn);
?>

Definition and Usage

The ftp_site() function sends an FTP SITE command to the FTP server.

Note: SITE commands vary from server to server. They are useful for handling OS specific features such as file permissions and group membership.

Tip: To see what SITE commands are available, send the REMOTEHELP command using the ftp_raw() function.

Syntax

ftp_site(ftp_connection,command);

Parameter Description
ftp_connection Required. Specifies the FTP connection to use
command Required. Specifies the SITE command (this parameter is not escaped)

Technical Details

Return Value: Returns TRUE on success or FALSE on failure
PHP Version: 4+

PHP FTP Reference PHP FTP Reference

COLOR PICKER

colorpicker

SHARE THIS PAGE






Search w3schools.com:

Translate w3schools.com: