how to overwrite folder/file if exist via php ftp using ftp_put . the default is not overwriting the files.
function ftp_putAll($conn_id, $folder, $remotedir) { // Called from moveFolder function at line 161 //
$d = dir($folder);
while($file = $d->read()) { // do this for each file in the directory
if ($file != "." && $file != "..") { // to prevent an infinite loop
if (is_dir($folder."/".$file)) { // do the following if it is a directory
if (!@ftp_chdir($conn_id, $remotedir."/".$file)) {
ftp_mkdir($conn_id, $remotedir."/".$file); // create directories that do not yet exist
}
$stream_options = array('ftp' => array('overwrite' => true));
$this->ftp_putAll($conn_id, $folder."/".$file, $remotedir."/".$file); // recursive part
} else {
if(ftp_put($conn_id, $remotedir."/".$file, $folder."/".$file, FTP_ASCII)) {
$upload = ftp_put($conn_id, $remotedir."/".$file, $folder."/".$file, FTP_ASCII);
}
else {
} }