I've seen two notes about a "ftp_copy" function but i think there's a misinterpretation about what an "ftp_copy" function should do. For me , it should be something like an ftp_rename that would keep the orginal file and clone it somewhere else on the same ftp server, as for them they consider its purpose is to copy a local file to a distant ftp ..well .. as in FTP protocol there's no such thing as an FTP COPY command anyway, i think you're free to interpret it as you want.
So here's my solution using ftp_put and ftp_get ..
<?php
function ftp_copy($conn_distant , $pathftp , $pathftpimg ,$img){
if(ftp_get($conn_distant, TEMPFOLDER.$img, $pathftp.'/'.$img ,FTP_BINARY)){
if(ftp_put($conn_distant, $pathftpimg.'/'.$img ,TEMPFOLDER.$img , FTP_BINARY)){
unlink(TEMPFOLDER.$img) ;
} else{
return false;
}
}else{
return false ;
}
return true ;
}
?>