FTP在同一台机器上传输文件?

I am trying to transfer files using FTP on the same machine. First of all, can we transfer files on the same machine. If yes, I don't understand what would be username and password for using ftp_put command? I am able to connect to localhost server but I am not able to login for uploading a file from one directory to 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."
";
       if (false === $con) {
           throw new Exception('Unable to connect');
              }
           } 
       catch (Exception $e) {
          echo "Failure: " . $e->getMessage();}

      $loggedIn = ftp_login($con,$username,$password);
        if (true === $loggedIn) {
           echo 'Success!';
               }
             else {
              throw new Exception('Unable to log in');
              }

       $ret = upload_file($con,$remote_path);
       if ($ret != FTP_FINISHED) {
           echo "Warning!! Server not able to uplaod";
           exit(1);
            }