Unfortunately I'm pretty sure copy() only works within the server's own filesystem (unless perhaps if you have url_fopen enabled, which I don't). Working with a separate/remote FTP server - that is, separate from the main site server - seems to require the FTP functions.
Here's my current solution (omitting less relevant code from class). Not ideal since every file copied has to be transferred twice.
public function copyRemoteFtp()
{
$srcDir = $this->fieldarray['sourceItemId'];
$destDir = $this->fieldarray['itemId'];
$localDir = PUBLIC_PATH . 'photos/' . $this->fieldarray['imageType'] . '/original/' . $this->fieldarray['itemId'];
if ($conn = ftp_connect(PHOTO_SERVER))
{
if (ftp_login($conn, PHOTO_SERVER_USER, PHOTO_SERVER_PW))
{
ftp_pasv($conn, true);
if (ftp_chdir($conn, PHOTO_SERVER_UPLOAD_DIR))
{
$rawList = ftp_nlist($conn, ".");
if (!in_array($destDir, $rawList))
{
ftp_mkdir($conn, $destDir);
//@ftp_chmod($conn, 0777, $image_dir);
}
$files = ftp_nlist($conn, $srcDir);
foreach ($files as $file)
{
if ($file != "." && $file != "..")
{
$srcFile = PHOTO_SERVER_FTP_GET_SRC_DIR . '/' . $srcDir . '/' . $file;
$localFile = $localDir . '/' . $file;
if (ftp_get($conn, $localFile, $srcFile, FTP_BINARY))
{
$upload = ftp_put($conn, $destDir . "/" . $file, $localFile, FTP_BINARY);
}
}
}
}
}
}
}