Yii Framework Forum: Php Ftp Code - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Php Ftp Code FTP Rate Topic: -----

#1 User is offline   Alankar Singh 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 22-March 12

Posted 24 April 2013 - 02:15 AM

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
0

#2 User is offline   Fabrizio Caldarelli 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 313
  • Joined: 21-March 13
  • Location:Rome, Italy

Posted 24 April 2013 - 02:33 AM

Is your "images" folder writable?

Why do you call "fopen('youtube.php')" before make ftp_put ?
0

#3 User is offline   Alankar Singh 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 22-March 12

Posted 24 April 2013 - 01:21 PM

View PostFabrizio Caldarelli, on 24 April 2013 - 02:33 AM, said:

Is your "images" folder writable?

Why do you call "fopen('youtube.php')" before make ftp_put ?


yes my image folder is writable.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users