File Transfert Protocol (FTP)¶
FTP stands for File Transfert Protocol. It is a protocol to transfert files between servers.
PHP supports FTP and FTPS, through the ext/ftp extension, the ext/curl extension and the internal wrappers.
<?php
$ftp = ftp_connect($ftpAddress);
$upload = ftp_put($ftp, $destinationPath, $sourceFile, FTP_BINARY);
if (!$upload) {
echo "FTP upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as $destination_file";
}
ftp_close($ftp);
?>
See also https://datatracker.ietf.org/doc/html/rfc959
Related : Wrapper, File Transfert Protocol Secure (FTPS)