Transfer uploaded image to another website directory
<p>I've a html upload form which process by Php. Following is the Upload Process code:</p>

<p><strong>Php uploading file process.</strong></p>

<pre><code>if($image["name"] != "")
{
//$path = PATH . DS . "uploads" . DS . "products" . DS . $id;
$path = "../../uploads" . DS . "products" . DS . $id;
if(!is_dir($path))
    {
mkdir($path);
}
chmod($path, 0755);
//move_uploaded_file($image["tmp_name"], $path . DS . $image["name"]);
move_uploaded_file($image["tmp_name"], $path . DS . 
$uploadImage);//exit;               
}
</code></pre>

<p>Now I'm trying to Transfer this uploaded image to another website directory in the same time with following code: </p>

<p><strong>Another Website Directory Example:</strong></p>

<pre><code>www.myanotherdomain.fr/onefolder/finalfolder/
</code></pre>

<p><strong>Transfer Code:</strong></p>

<pre><code>// FTP access parameters
$host = 'hostname';
$usr = 'username';
$pwd = 'password';

// file to move:
$local_file = "../../uploads" . DS . "products" . DS . $id;
$ftp_path = "www.myanotherdomain.fr/onefolder/finalfolder";

// connect to FTP server (port 21)
$conn_id = ftp_connect($host, 21) or die ("Cannot connect to host");

// send access parameters
ftp_login($conn_id, $usr, $pwd) or die("Cannot login");

// turn on passive mode transfers (some servers need this)
// ftp_pasv ($conn_id, true);

// perform file upload
$upload = ftp_put($conn_id, $ftp_path, $local_file, FTP_ASCII);

// check upload status:
print (!$upload) ? 'Cannot upload' : 'Upload complete';
print "\n";

/*
** Chmod the file (just as example)
*/

// If you are using PHP4 then you need to use this code:
// (because the "ftp_chmod" command is just available in PHP5+)
if (!function_exists('ftp_chmod')) {
function ftp_chmod($ftp_stream, $mode, $filename){
    return ftp_site($ftp_stream, sprintf('CHMOD %o %s', $mode, $filename));
}
}

// try to chmod the new file to 666 (writeable)
if (ftp_chmod($conn_id, 0666, $ftp_path) !== false) {
print $ftp_path . " chmoded successfully to 666\n";
} else {
print "could not chmod $file\n";
}

// close the FTP stream
ftp_close($conn_id);
</code></pre>

<p>But unfortunately it doesn't upload to my another website directory. Is there any wrong in my code or Is there any other way to upload to another website directory too.   </p>

<p>Thanks.</p>

<p><strong>UPDATE:</strong></p>

<pre><code>Warning: ftp_put() [function.ftp-put]: Prohibited file name:  
www.myanotherdomain.fr/onefolder/finalfolder/ in /home/gastrono1/www/admin/actions
/productAction.php on line 86
Cannot upload 


Warning: ftp_chmod() [function.ftp-chmod]: Could not change perms on 
www.myanotherdomain.fr/onefolder/finalfolder/: No such file or directory in 
/home/gastrono1/www/admin/actions/productAction.php on line 105
</code></pre>
