Php Ftp Code

Hi

I am trying to built a code for FTP in yii. Every thing is working fine but problem occures when i am trying to FTPES (secure server).

I can establish connect, create and delete folder but when i am trying to move file it transfers 0byte file. My code is given below that is in core php




$ftp_server='ftp.example.com';

$ftp_user_name='example@example.com';

$ftp_user_pass='test';

        

 echo $conn_id = ftp_ssl_connect("ftp.example.com") or die("Could not connect");       

 //echo $conn_id = ftp_ssl_connect($ftp_server);

 

 


// login with username and password

echo $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);


//echo ftp_pwd($conn_id); // /

//echo ftp_mkdir($conn_id,"images/testdir");

//ftp_rmdir($conn_id,"testdir");

echo ftp_pasv($conn_id,true);




$source = fopen("youtube.php","r");


// Print a directory listing


//print_r(ftp_nlist($conn_id, "/images"));


 //print_r( $source );

 //echo ftp_fput($conn_id,"images/a.php",$source,FTP_ASCII);

//print_r(ftp_nlist($conn_id,'/wp-admin'));

$transfer_result = ftp_put( $conn_id, "images/a.php", 'youtube.php', FTP_ASCII );

 if( $transfer_result)

    {

        echo "Success";

    }

    else

    {

        echo "An error occured";

    }


//print_r($list);

// close the ssl connection

ftp_close($conn_id);

?>



anyone please rectify by issue .

Thanks

Is your "images" folder writable?

Why do you call “fopen(‘youtube.php’)” before make ftp_put ?

yes my image folder is writable.