コード例 #1
0
ファイル: PurFtp.php プロジェクト: rintaun/himawari
	/**
	 * Warning: Not tested, not flexible. Found on http://www.php.net/ftp_put as a 
	 * groundwork for later develepment
	 *   
	 * @return array
	 * @param $arrayToSort array
	 * @param $arrayKeysReference array
	 * @param $key string
	 */
	public static function copy($con,$source,$dest){
		$d = dir($source);
			while($file = $d->read()){
				if ($file != "." && $file != "..") {
					if (is_dir($source."/".$file)) {
						if (!@ftp_chdir($con, $dest."/".$file)) {
							ftp_mkdir($con, $dest."/".$file);
						}
						ftp_copy($source."/".$file, $dest."/".$file);
					}
					else{
						$upload = ftp_put($con, $dest."/".$file, $source."/".$file, FTP_BINARY);
					}
				}
			}
		$d->close();
	}
コード例 #2
0
function ftp_copy($src_dir, $dst_dir)
{
    global $conn_id;
    $d = dir($src_dir);
    while ($file = $d->read()) {
        if ($file != "." && $file != "..") {
            if (is_dir($src_dir . "/" . $file)) {
                if (!@ftp_chdir($conn_id, $dst_dir . "/" . $file)) {
                    ftp_mkdir($conn_id, $dst_dir . "/" . $file);
                }
                ftp_copy($src_dir . "/" . $file, $dst_dir . "/" . $file);
            } else {
                $upload = ftp_put($conn_id, $dst_dir . "/" . $file, $src_dir . "/" . $file, FTP_BINARY);
            }
        }
    }
    $d->close();
}
コード例 #3
0
function ftp_copy($src_dir, $dst_dir)
{
    global $conn_id;
    //	$blmFile = date('Ymd').".txt";
    $d = dir($src_dir);
    while ($file = $d->read()) {
        if ($file != "." && $file != "..") {
            if (is_dir($src_dir . "/" . $file)) {
                if (!@ftp_chdir($conn_id, $dst_dir . "/" . $file)) {
                    ftp_mkdir($conn_id, $dst_dir . "/" . $file);
                }
                ftp_copy($src_dir . "/" . $file, $dst_dir . "/" . $file);
            } else {
                //				if (strcmp($blmFile, $file)!=0) { // Added
                $upload = ftp_put($conn_id, $dst_dir . "/" . $file, $src_dir . "/" . $file, FTP_BINARY);
                //				}
            }
        }
    }
    //	   $upload = ftp_put($conn_id, $dst_dir."/".$blmFile, $src_dir."/".$file, FTP_ASCII); //Added
    $d->close();
}
コード例 #4
0
ファイル: test_ftp.php プロジェクト: jankichaudhari/yii-site
    $blmFile = date('Ymd') . ".tar.gz";
    echo $strpath;
    echo ftp_put($conn_id, $dst_dir . "/" . $blmFile, $src_dir . "/" . $blmFile, FTP_ASCII);
    //Added
    echo "File FTP'd";
    echo TRUE;
}
// path to save text file
$strFolderName = date('Ymd');
$strPath = '/home/woosterstock/htdocs/v3.0/live/admin/feed/rightmove/' . $strFolderName;
// name of textfile (date.blm)
$strTextFile = date('Ymd') . ".blm";
// ******************* FindaProperty **********************
// log in to ftp site and upload contents of folder
$ftp_server = "fapfeed.findaproperty.com";
//81.171.194.128
$ftp_username = "******";
$ftp_password = "******";
#$conn_id = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
if (ftp_connect($ftp_server)) {
    $conn_id = ftp_connect($ftp_server);
} else {
    $errors[] = "could not connect to {$ftp_server}";
}
$login_result = ftp_login($conn_id, $ftp_username, $ftp_password);
ftp_pasv($conn_id, true);
// Passive mode to test ftp
$src_dir = $strPath;
$dst_dir = ".";
ftp_copy($src_dir, $dst_dir);
ftp_close($conn_id);
コード例 #5
0
     // if you don't have permission to move the file/dir
     if (!$result) {
         $sess_Data["warn"] = sprintf("{$code_pd}: {$pd_move}.", $old, $new);
         $sess_Data["level"] = "major";
         // log error if set too
         if ($log["level"] > 1) {
             log_message($log, $sess_Data["user"] . "/" . $REMOTE_ADDR . " - " . sprintf("{$code_pd}: {$pd_move}.", $old, $new) . "\n");
         }
     } else {
         $sess_Data["warn"] = sprintf("{$code_suc}: {$suc_move}.", $old, $new);
         $sess_Data["level"] = "info";
     }
 } else {
     $old = $sess_Data["copy_path"] . "/" . $sess_Data["copy_old"];
     $new = $sess_Data["dir"] . "/" . $sess_Data["copy_old"];
     $result = ftp_copy($fp, $sess_Data["copy_path"], $sess_Data["dir"], $sess_Data["copy_old"]);
     if (!$result) {
         $sess_Data["warn"] = sprintf("{$code_pd}: {$pd_copy}.", $old, $new);
         $sess_Data["level"] = "major";
         // log error if set too
         if ($log["level"] > 1) {
             log_message($log, $sess_Data["user"] . "/" . $REMOTE_ADDR . " - " . sprintf("{$code_pd}: {$pd_copy}.", $old, $new) . "\n");
         }
     } else {
         $sess_Data["warn"] = sprintf("{$code_suc}: {$suc_copy}.", $old, $new);
         $sess_Data["level"] = "info";
     }
 }
 unset($sess_Data["copy_path"]);
 unset($sess_Data["copy_old"]);
 unset($sess_Data["move_path"]);