FTP stands for File Transfer Protocol. In normal words, Ftp is used for uploading files into a remote server. For eg, for hosting a website, we actually upload the files into the server space provided.
The server space comes with a host name or ip, user name, password and a port number. Here is the program to use php for ftp operation.
$file = 'file.txt';
$remote_file = 'readme.txt';
// set up basic connection
$conn_id = ftp_connect($server);
// login with username and password
$login = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// upload a file
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
echo "successfully uploaded $file\n";
}else {
echo "There was a problem while uploading $file\n";
}
// close the connection
ftp_close($conn_id);