• 16-05-2010, 10:06:40
    #1
    Kimlik doğrulama veya yönetimden onay bekliyor.
    You tube videolarını kendi serverıma indirmeden direk ftp ile başka servera yükleyebilirmiyim?
  • 16-05-2010, 11:24:09
    #2
    evet yükleyebilirsin de,

    curl örnek.
    http://www.web-development-blog.com/...load-via-curl/

     	$ch = curl_init();
     	$localfile = $_FILES['upload']['tmp_name'];
     	$fp = fopen($localfile, 'r');
     	curl_setopt($ch, CURLOPT_URL, 'ftp://ftp_login:password@ftp.domain.com/'.$_FILES['upload']['name']);
     	curl_setopt($ch, CURLOPT_UPLOAD, 1);
     	curl_setopt($ch, CURLOPT_INFILE, $fp);
     	curl_setopt($ch, CURLOPT_INFILESIZE, filesize($localfile));
     	curl_exec ($ch);
     	$error_no = curl_errno($ch);
     	curl_close ($ch);
            if ($error_no == 0) {
            	$error = 'File uploaded succesfully.';
            } else {
            	$error = 'File upload error.';
            }

    curl kullanmadan php ftp
    http://www.weberdev.com/get_example-3544.html

    <?php
    $ftp_user_name='XXXXXXXX';
    $ftp_user_pass='XXXXXXXX';
    $ftp_server='ftp.YOURSITE.com';
    $ftp_dir='/YOURSITE.COM/public_html/upload/';
    
    $web_dir='../upload/';
    $web_location=$web_dir.$imagefile_name;
    $destination_file=$ftp_dir.$imagefile_name;
    
    $conn_id = ftp_connect($ftp_server);
    $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
    $upload = ftp_put($conn_id, $destination_file, $imagefile, FTP_BINARY);
    
    $ch=ftp_site($conn_id,"chmod 777 ".$destination_file);
    
    ftp_close($conn_id);
    
    
    if (file_exists($web_location))
            {
            echo "file was uploaded as $web_location";
            }
    else
            {
            echo "Could not create $web_location";
            }
    ?>