php - FTP transfer of files on the same machine? -


i trying transfer files using ftp on same machine. first of all, can transfer files on same machine. if yes, don't understand username , password using ftp_put command? able connect localhost server not able login uploading file 1 directory other.

function upload_file($con,$remote_path)     {          $source_file = "testfile.txt";           $ret = ftp_put($con,$remote_path,$source_file,ftp_ascii);       while ($ret == ftp_moredata) {        echo "uploading....";        $ret = ftp_nb_continue($con);         }     return($ret);      }         $host = "localhost";  //address of ftp server        $username = ""; // username        $password = ""; //password        $remote_path = "ftp://localhost/";         $local_path = "/home/random/";         try {        $con = ftp_connect($host);        echo $con."\n";        if (false === $con) {            throw new exception('unable connect');               }            }         catch (exception $e) {           echo "failure: " . $e->getmessage();}        $loggedin = ftp_login($con,$username,$password);         if (true === $loggedin) {            echo 'success!';                }              else {               throw new exception('unable log in');               }         $ret = upload_file($con,$remote_path);        if ($ret != ftp_finished) {            echo "warning!! server not able uplaod";            exit(1);             } 


Comments