How would I go about copying a file in PHP to a remote server? I would prefer to not use external libraries
You can use FTP Function to copy file from local to remote :
<?php
$connect = ftp_connect('111.111.111'); //connect to server
$login = ftp_login($connect, 'ftp_username', 'ftp_password');
if($login)
{
if(ftp_put($connect, '/home/user/john/tes.txt','tes.txt', FTP_BINARY))
{
echo "Success";
}
}
ftp_close($connect);
?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.