当前位置: 首页>>代码示例>>PHP>>正文


PHP ftp_nb_put函数代码示例

本文整理汇总了PHP中ftp_nb_put函数的典型用法代码示例。如果您正苦于以下问题:PHP ftp_nb_put函数的具体用法?PHP ftp_nb_put怎么用?PHP ftp_nb_put使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ftp_nb_put函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: poll

 function poll()
 {
     if (!count($this->connections)) {
         return -1;
     }
     // no connections open
     $return = 0;
     // we have transfers in queue
     if (count($this->transfers)) {
         foreach ($this->transfers as $k => $transfer) {
             // if we have an open connection
             if ($ftph = $this->get_free_connection()) {
                 $this->activate_transfer($ftph, $k);
             } else {
                 // none available so stop sifting through the queue
                 break;
             }
         }
         $return = 1;
         // we are busy
     }
     foreach ($this->active_connections as $k => $transfer) {
         $ftph = $transfer['ftph'];
         if ($transfer['type'] == 'put') {
             if (!$transfer['status']) {
                 $ret = ftp_nb_put($ftph, $transfer['remote'], $transfer['local'], FTP_BINARY);
                 if ($ret == FTP_FAILED && $transfer['error_callback']) {
                     $transfer['error_callback']($transfer, $this);
                 } else {
                     if ($ret == FTP_MOREDATA) {
                         $this->active_connections[$k]['status'] = 'busy';
                     } else {
                         if ($ret == FTP_FINISHED && $transfer['success_callback']) {
                             $transfer['success_callback']($transfer, $this);
                         }
                     }
                 }
                 if ($ret == FTP_FAILED || $ret == FTP_FINISHED) {
                     $this->free_connection($ftph);
                 }
             } elseif ($transfer['status'] == 'busy') {
                 $ret = ftp_nb_continue($ftph);
                 if ($ret == FTP_FAILED && $transfer['error_callback']) {
                     $transfer['error_callback']($transfer, $this);
                 } else {
                     if ($ret == FTP_FINISHED && $transfer['success_callback']) {
                         $transfer['success_callback']($transfer, $this);
                     }
                 }
                 if ($ret == FTP_FAILED || $ret == FTP_FINISHED) {
                     $this->free_connection($ftph);
                 }
             }
         }
         $return = 1;
         // we are busy
     }
     return $return;
     // we are done
 }
开发者ID:lcw07r,项目名称:productcampamsterdam.org,代码行数:60,代码来源:ftp-bulk-transfer.php

示例2: syncFolderToFtp

function syncFolderToFtp($host, $username, $password, $remote_backup, $backup_folder)
{
    $ftp = ftp_connect($host);
    // connect to the ftp server
    ftp_login($ftp, $username, $password);
    // login to the ftp server
    ftp_chdir($ftp, $remote_backup);
    // cd into the remote backup folder
    // copy files from folder to remote folder
    $files = glob($backup_folder . '*');
    $c = 0;
    $allc = count($files);
    foreach ($files as $file) {
        $c++;
        $file_name = basename($file);
        echo "\n {$c}/{$allc}: {$file_name}";
        $upload = ftp_nb_put($ftp, $file_name, $file, FTP_BINARY);
        // non-blocking put, uploads the local backup onto the remote server
        while ($upload == FTP_MOREDATA) {
            // Continue uploading...
            $upload = ftp_nb_continue($ftp);
        }
        if ($upload != FTP_FINISHED) {
            echo " ... ERROR";
        } else {
            echo " ... OK";
        }
    }
    ftp_close($ftp);
    // closes the connection
}
开发者ID:mtancek,项目名称:php-sync-folder-to-remote-ftp,代码行数:31,代码来源:index.php

示例3: upload

 /**
  * 上传文件
  * 
  */
 public function upload($remotefile, $localfile)
 {
     $res = ftp_nb_put($this->ftpobj, $remotefile, $localfile, $this->mode, ftp_size($this->ftpobj, $remotefile));
     while ($res == FTP_MOREDATA) {
         $res = ftp_nb_continue($this->ftpobj);
     }
     if ($res != FTP_FINISHED) {
         return FALSE;
     }
     return TRUE;
 }
开发者ID:tiger2soft,项目名称:LycPHP,代码行数:15,代码来源:Ftp.class.php

示例4: put

 function put($localFile, $remoteFile = '')
 {
     if ($remoteFile == '') {
         $remoteFile = end(explode('/', $localFile));
     }
     $res = ftp_nb_put($this->ftpR, $remoteFile, $localFile, FTP_BINARY);
     while ($res == FTP_MOREDATA) {
         $res = ftp_nb_continue($this->ftpR);
     }
     if ($res == FTP_FINISHED) {
         return true;
     } elseif ($res == FTP_FAILED) {
         return false;
     }
 }
开发者ID:iwarsong,项目名称:NCMI,代码行数:15,代码来源:ftp.cls.php

示例5: upload

 /**
  * FTP-文件上传
  * @param string $localFile 本地文件
  * @param string $ftpFile Ftp文件
  * @return bool
  */
 public function upload($localFile, $ftpFile)
 {
     if (!$localFile || !$ftpFile) {
         return false;
     }
     $ftppath = dirname($ftpFile);
     if (!empty($ftppath)) {
         //创建目录
         $this->makeDir($ftppath);
         @ftp_chdir($this->link, $ftppath);
         $ftpFile = basename($ftpFile);
     }
     $ret = ftp_nb_put($this->link, $ftpFile, $localFile, FTP_BINARY);
     while ($ret == FTP_MOREDATA) {
         $ret = ftp_nb_continue($this->link);
     }
     return $ret == FTP_FINISHED;
 }
开发者ID:chaoyanjie,项目名称:MonkeyPHP,代码行数:24,代码来源:FTPClient.php

示例6: upload

 /**
  * FTP-文件上传
  *
  * @access public
  *
  * @param string  $localFile 本地文件
  * @param string  $ftpFile Ftp文件
  *
  * @return boolean
  */
 public function upload($localFile, $ftpFile)
 {
     if (!$localFile || !$ftpFile) {
         return false;
     }
     $ftpPath = dirname($ftpFile);
     if ($ftpPath) {
         //创建目录
         $this->makeDir($ftpPath);
         @ftp_chdir($this->_linkId, $ftpPath);
         $ftpFile = basename($ftpFile);
     }
     $ret = ftp_nb_put($this->_linkId, $ftpFile, $localFile, FTP_BINARY);
     while ($ret == FTP_MOREDATA) {
         $ret = ftp_nb_continue($this->_linkId);
     }
     if ($ret != FTP_FINISHED) {
         return false;
     }
     return true;
 }
开发者ID:a53abc,项目名称:doitphp,代码行数:31,代码来源:Ftp.class.php

示例7: upload

 /**
  * FTP-文件上传
  *
  * @param string  $local_file 本地文件
  * @param string  $ftp_file Ftp文件
  *
  * @return bool
  */
 public function upload($local_file, $ftp_file)
 {
     if (empty($local_file) || empty($ftp_file)) {
         return false;
     }
     $ftppath = dirname($ftp_file);
     if (!empty($ftppath)) {
         //创建目录
         $this->makeDir($ftppath);
         @ftp_chdir($this->linkid, $ftppath);
         $ftp_file = basename($ftp_file);
     }
     $ret = ftp_nb_put($this->linkid, $ftp_file, $local_file, FTP_BINARY);
     while ($ret == FTP_MOREDATA) {
         $ret = ftp_nb_continue($this->linkid);
     }
     if ($ret != FTP_FINISHED) {
         return false;
     }
     return true;
 }
开发者ID:phpdn,项目名称:framework,代码行数:29,代码来源:Ftp.php

示例8: start_connect

function start_connect($files)
{
    global $task, $_CONFIG;
    if ($_REQUEST[task] == 'move' || $_REQUEST[task2] == 'move') {
    } else {
        $source_file[0] = "restore/XCloner.php";
        $destination_file[0] = $_REQUEST[ftp_dir] . "/XCloner.php";
        $source_file[1] = "restore/TAR.php";
        $destination_file[1] = $_REQUEST[ftp_dir] . "/TAR.php";
    }
    foreach ($files as $file) {
        $source_file[] = $_CONFIG['clonerPath'] . "/" . $file;
        $destination_file[] = $_REQUEST[ftp_dir] . "/" . $file;
    }
    list($fhost, $fport) = explode(":", $_REQUEST[ftp_server]);
    if ($fport == "") {
        $fport = '21';
    }
    $ftp_timeout = '3600';
    // set up basic connection
    if (!$_CONFIG[secure_ftp]) {
        $conn_id = ftp_connect($fhost, (int) $fport, (int) $ftp_timeout);
        $connect = "Normal";
    } else {
        $conn_id = ftp_ssl_connect($fhost, (int) $fport, (int) $ftp_timeout);
        $connect = "Secure";
    }
    // login with username and password
    $login_result = @ftp_login($conn_id, $_REQUEST[ftp_user], $_REQUEST[ftp_pass]);
    // check connection
    if (!$conn_id || !$login_result) {
        echo "<b  style='color:red'>" . LM_MSG_BACK_2 . "</b>";
        echo "<b  style='color:red'>Attempted to connect to " . $_REQUEST[ftp_server] . " for user " . $_REQUEST[ftp_user] . "</b>";
        return;
    } else {
        #echo "Connected to $_REQUEST[ftp_server], for user $_REQUEST[ftp_user]";
    }
    if ($_CONFIG[system_ftptransfer] == 1) {
        // turn passive mode on
        @ftp_pasv($conn_id, true);
        $mode = "Passive";
    } else {
        // turn passive mode off
        @ftp_pasv($conn_id, false);
        $mode = "Active";
    }
    echo "Connected to {$connect} ftp server <b>{$_REQUEST['ftp_server']} - {$mode} Mode</b><br />";
    for ($i = 0; $i < sizeof($source_file); $i++) {
        echo "<br />Moving source file <b>" . $source_file[$i] . "</b>";
        // upload the file
        if (!$_REQUEST['ftp_inct']) {
            $ret = ftp_put($conn_id, $destination_file[$i], $source_file[$i], FTP_BINARY);
            if ($ret) {
                echo "<br /><b>Upload success to <i>{$destination_file[$i]}</i> ...<br /></b>";
            } else {
                echo "<b style='color:red'>FTP upload has failed for file {$destination_file[$i]} ! Stopping ....<br /></b>";
                return;
            }
        }
        if ($_REQUEST['ftp_inct']) {
            $size = filesize($source_file[$i]);
            $dsize = ftp_size($conn_id, $destination_file[$i]);
            $perc = sprintf("%.2f", $dsize * 100 / $size);
            echo " - uploaded {$perc}% from {$size} bytes <br>";
            $ret = ftp_nb_put($conn_id, $destination_file[$i], $source_file[$i], FTP_BINARY, FTP_AUTORESUME);
            // check upload status
            if ($ret == FTP_FAILED) {
                echo "<b style='color:red'>FTP upload has failed for file {$destination_file[$i]} ! Stopping ....<br /></b>";
                return;
            } else {
                $j = 1;
                while ($ret == FTP_MOREDATA) {
                    // Do whatever you want
                    #echo ". ";
                    // Continue uploading...
                    $ret = ftp_nb_continue($conn_id);
                    if ($j++ % 500 == 0) {
                        @ftp_close($conn_id);
                        echo "<script>\n\t\tvar sURL = unescape('" . $_SERVER[REQUEST_URI] . "');\n\n\t    function refresh()\n\t    {\n\t    //  This version of the refresh function will cause a new\n\t    //  entry in the visitor's history.  It is provided for\n\t    //  those browsers that only support JavaScript 1.0.\n\t    //\n\t    window.location.href = sURL;\n\t    }\n\n\t\tsetTimeout( \"refresh()\", 2*1000 );\n\t\t\n\t\t</script>";
                        return 1;
                        break;
                    }
                }
                if ($ret == FTP_FINISHED) {
                    echo "<b>Upload success to <i>{$destination_file[$i]}</i> ...<br /></b>";
                }
            }
        }
    }
    // close the FTP stream
    @ftp_close($conn_id);
    $redurl = $_REQUEST[ftp_url] . "/XCloner.php";
    if (substr($redurl, 0, 7) != "http://" && substr($redurl, 0, 8) != "https://") {
        $redurl = "http://" . trim($redurl);
    }
    if ($_REQUEST['ftp_inct']) {
        if ($_REQUEST['refresh_done'] != 1) {
            echo "<script>\n\t\tvar sURL = unescape('" . $_SERVER[REQUEST_URI] . "&refresh_done=1');\n\n\t    function refresh()\n\t    {\n\t    //  This version of the refresh function will cause a new\n\t    //  entry in the visitor's history.  It is provided for\n\t    //  those browsers that only support JavaScript 1.0.\n\t    //\n\t    window.location.href = sURL;\n\t    }\n\n\t\tsetTimeout( \"refresh()\", 2*1000 );\n\t\t\n\t\t</script>";
            return 1;
        }
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:owaspbwa,代码行数:101,代码来源:cloner.functions.php

示例9: putNb

 /**
  * Stores a file on the server (non blocking)
  * @link http://php.net/ftp_nb_put
  *
  * @param  string  $remoteFile The remote file path
  * @param  string  $localFile  The local file path
  * @param  integer $mode       The transfer mode (FTPWrapper::ASCII or FTPWrapper::BINARY)
  * @param  integer $startpos   The position in the remote file to start downloading from
  * @return integer FTPWrapper::FAILED, FTPWrapper::FINISHED or FTPWrapper::MOREDATA
  */
 public function putNb($remoteFile, $localFile, $mode = self::BINARY, $startpos = 0)
 {
     return ftp_nb_put($this->connection->getStream(), $remoteFile, $localFile, $mode, $startpos);
 }
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:14,代码来源:FTPWrapper.php

示例10: ftp_uploading_compile

function ftp_uploading_compile($ftpFolder, $connect_data, $current_file_uri, $current_file_dir)
{
    $ftp_connect = @ftp_connect($connect_data['ftp_hostname']);
    $ftp_login = @ftp_login($ftp_connect, $connect_data['ftp_username'], $connect_data['ftp_password']);
    if (!$ftp_login) {
        return false;
    } else {
        if (substr($ftpFolder, strlen($ftpFolder) - 1) != "/") {
            $d = ftp_nb_put($ftp_connect, $ftpFolder . '/archive.zip', $current_file_dir, FTP_BINARY);
        } else {
            $d = ftp_nb_put($ftp_connect, $ftpFolder . 'archive.zip', $current_file_dir, FTP_BINARY);
        }
        while ($d == FTP_MOREDATA) {
            $d = ftp_nb_continue($ftp_connect);
        }
        if ($d != FTP_FINISHED) {
            exit(1);
        }
        if (substr($ftpFolder, strlen($ftpFolder) - 1) != "/") {
            $d = ftp_nb_put($ftp_connect, $ftpFolder . '/unziper.php', COMPILER_FOLDER . 'unzip.php', FTP_BINARY);
        } else {
            $d = ftp_nb_put($ftp_connect, $ftpFolder . 'unziper.php', COMPILER_FOLDER . 'unzip.php', FTP_BINARY);
        }
        while ($d == FTP_MOREDATA) {
            $d = ftp_nb_continue($ftp_connect);
        }
        if ($d != FTP_FINISHED) {
            exit(1);
        }
        if (substr($connect_data['site_url'], strlen($connect_data['site_url']) - 1) != "/") {
            $host['unzip'] = $connect_data['site_url'] . '/unziper.php';
            $host['dump'] = $connect_data['site_url'] . '/db_upload.php';
        } else {
            $host['unzip'] = $connect_data['site_url'] . 'unziper.php';
            $host['dump'] = $connect_data['site_url'] . 'db_upload.php';
        }
        $host['link'] = $connect_data['site_url'];
        // close connection
        ftp_close($ftp_connect);
        echo json_encode($host);
        return true;
    }
}
开发者ID:mprihodko,项目名称:compiler,代码行数:43,代码来源:create_compile.php

示例11: put

 /**
  * This function will upload a file to the ftp-server. You can either specify a
  * absolute path to the remote-file (beginning with "/") or a relative one,
  * which will be completed with the actual directory you selected on the server.
  * You can specify the path from which the file will be uploaded on the local
  * maschine, if the file should be overwritten if it exists (optionally, default
  * is no overwriting) and in which mode (FTP_ASCII or FTP_BINARY) the file
  * should be downloaded (if you do not specify this, the method tries to
  * determine it automatically from the mode-directory or uses the default-mode,
  * set by you).
  * If you give a relative path to the local-file, the script-path is used as
  * basepath.
  *
  * @param string $local_file  The local file to upload
  * @param string $remote_file The absolute or relative path to the file to
  *                            upload to
  * @param bool   $overwrite   (optional) Whether to overwrite existing file
  * @param int    $mode        (optional) Either FTP_ASCII or FTP_BINARY
  * @param int    $options     (optional) Flags describing the behaviour of this
  *                            function. Currently NET_FTP_BLOCKING and 
  *                            NET_FTP_NONBLOCKING are supported, of which
  *                            NET_FTP_NONBLOCKING is the default.
  *
  * @access public
  * @return mixed True on success, otherwise PEAR::Error
  * @see NET_FTP_ERR_LOCALFILENOTEXIST,
  *      NET_FTP_ERR_OVERWRITEREMOTEFILE_FORBIDDEN,
  *      NET_FTP_ERR_UPLOADFILE_FAILED, NET_FTP_NONBLOCKING, NET_FTP_BLOCKING
  */
 function put($local_file, $remote_file, $overwrite = false, $mode = null, $options = 0)
 {
     if ($options & (NET_FTP_BLOCKING | NET_FTP_NONBLOCKING) === (NET_FTP_BLOCKING | NET_FTP_NONBLOCKING)) {
         return $this->raiseError('Bad options given: NET_FTP_NONBLOCKING and ' . 'NET_FTP_BLOCKING can\'t both be set', NET_FTP_ERR_BADOPTIONS);
     }
     $usenb = !($options & NET_FTP_BLOCKING == NET_FTP_BLOCKING);
     if (!isset($mode)) {
         $mode = $this->checkFileExtension($local_file);
     }
     $remote_file = $this->_constructPath($remote_file);
     if (!@file_exists($local_file)) {
         return $this->raiseError("Local file '{$local_file}' does not exist.", NET_FTP_ERR_LOCALFILENOTEXIST);
     }
     if (@ftp_size($this->_handle, $remote_file) != -1 && !$overwrite) {
         return $this->raiseError("Remote file '" . $remote_file . "' exists and may not be overwriten.", NET_FTP_ERR_OVERWRITEREMOTEFILE_FORBIDDEN);
     }
     if (function_exists('ftp_alloc')) {
         ftp_alloc($this->_handle, filesize($local_file));
     }
     if ($usenb && function_exists('ftp_nb_put')) {
         $res = @ftp_nb_put($this->_handle, $remote_file, $local_file, $mode);
         while ($res == FTP_MOREDATA) {
             $this->_announce('nb_put');
             $res = @ftp_nb_continue($this->_handle);
         }
     } else {
         $res = @ftp_put($this->_handle, $remote_file, $local_file, $mode);
     }
     if (!$res) {
         return $this->raiseError("File '{$local_file}' could not be uploaded to '" . $remote_file . "'.", NET_FTP_ERR_UPLOADFILE_FAILED);
     } else {
         return true;
     }
 }
开发者ID:uda,项目名称:jaws,代码行数:63,代码来源:FTP.php

示例12: put

 /**
  * Upload a file to the FTP server.
  *
  * @param	string local file
  * @param	string remote file
  * @param	const  mode
  * @return	boolean
  */
 public function put($local, $remote = null, $mode = FTP_BINARY, $asynchronous = false)
 {
     if ($this->getActive()) {
         if (!isset($remote) || $remote == null || !is_string($remote) || trim($remote) == '') {
             $remote = basename($local);
             try {
                 $remote = $this->currentDir() . '/' . $remote;
             } catch (\Exception $e) {
             }
         }
         if ($asynchronous === false) {
             // Upload the local file to the remote location specified
             if (ftp_put($this->_connection, $remote, $local, $mode)) {
                 return true;
             } else {
                 return false;
             }
         } else {
             $ret = ftp_nb_put($this->_connection, $remote, $local, $mode);
             while ($ret == FTP_MOREDATA) {
                 $ret = ftp_nb_continue($this->_connection);
             }
             if ($ret !== FTP_FINISHED) {
                 return false;
             } else {
                 return true;
             }
         }
     } else {
         throw new \Exception('EFtpComponent is inactive and cannot perform any FTP operations.');
     }
 }
开发者ID:jymsy,项目名称:sky2,代码行数:40,代码来源:Ftp.php

示例13: moveTo

 /**
  * Uploads the files asynchronously, so the class can perform other operations 
  * while files are being uploaded, such :
  * display a progress bar in indeterminate mode. 
  *
  * @param      string    $dest          Changes from current to the specified directory.
  * @param      boolean   $overwrite     (optional) overwrite existing files.
  *
  * @return     mixed                    a null array if all files transfered
  * @since      1.1
  * @access     public
  * @see        FTP_Upload::setFiles()
  */
 function moveTo($dest, $overwrite = false)
 {
     if (!is_string($dest)) {
         Error_Raise::raise($this->_package, HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$dest', 'was' => gettype($dest), 'expected' => 'string', 'paramnum' => 1), PEAR_ERROR_TRIGGER);
     } elseif (!is_bool($overwrite)) {
         Error_Raise::raise($this->_package, HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$overwrite', 'was' => gettype($overwrite), 'expected' => 'boolean', 'paramnum' => 2), PEAR_ERROR_TRIGGER);
     }
     $dir = parent::_changeDir($dest);
     if (PEAR::isError($dir)) {
         return $dir;
     }
     $remoteFiles = ftp_nlist($this->_conn, '.');
     if ($remoteFiles === false) {
         return PEAR::raiseError('Couldn\'t read directory ' . $dest);
     }
     $nomove = array();
     // files not transfered on remote host
     foreach ($this->_files as $file) {
         if (!$overwrite && in_array(basename($file), $remoteFiles)) {
             // file already exists, skip to next one
             continue;
         }
         // writes file caption
         $status = ob_get_clean();
         $status = '<script type="text/javascript">self.setStatus(\'';
         $status .= sprintf($this->captionMask, basename($file));
         $status .= '\'); </script>';
         echo $status;
         ob_start();
         $ret = ftp_nb_put($this->_conn, basename($file), $file, FTP_BINARY);
         while ($ret == FTP_MOREDATA) {
             $this->_progress->display();
             // sleep a bit ...
             for ($i = 0; $i < $this->_progress->_anim_speed * 1000; $i++) {
             }
             if ($this->_progress->getPercentComplete() == 1) {
                 $this->_progress->setValue(0);
             } else {
                 $this->_progress->incValue();
             }
             // upload Continue ...
             $ret = ftp_nb_continue($this->_conn);
         }
         if ($ret != FTP_FINISHED) {
             $nomove[] = $file;
         }
     }
     return $nomove;
 }
开发者ID:BackupTheBerlios,项目名称:urulu-svn,代码行数:62,代码来源:uploader.php

示例14: put

 /**
  * @see RemoteDriver::put($mode, $local_file, $remote_file, $asynchronous)
  */
 public function put($local_file, $remote_file = null, $mode = FTP_ASCII, $asynchronous = false)
 {
     $this->connectIfNeeded();
     if (!isset($remote_file) || $remote_file == null || !is_string($remote_file) || trim($remote_file) == "") {
         $remote_file = basename($local_file);
     }
     $this->param = array('remote_file' => $remote_file, 'local_file' => $local_file, 'asynchronous' => $asynchronous);
     if ($asynchronous !== true) {
         if (!ftp_put($this->handle, $remote_file, $local_file, $mode)) {
             throw new FtpException(Yii::t('gftp', 'Could not put file "{local_file}" on "{remote_file}" on server "{host}"', ['host' => $this->host, 'remote_file' => $remote_file, 'local_file' => $local_file]));
         }
     } else {
         $ret = ftp_nb_put($this->handle, $remote_file, $local_file, $mode);
         while ($ret == FTP_MOREDATA) {
             $ret = ftp_nb_continue($this->handle);
         }
         if ($ret !== FTP_FINISHED) {
             throw new FtpException(Yii::t('gftp', 'Could not put file "{local_file}" on "{remote_file}" on server "{host}"', ['host' => $this->host, 'remote_file' => $full_remote_file, 'local_file' => $local_file]));
         }
     }
     return $full_remote_file;
 }
开发者ID:komaspieler,项目名称:yii2-gftp,代码行数:25,代码来源:FtpDriver.php

示例15: put

 public function put($path, $local)
 {
     $path = $this->path($path);
     // Directory support
     if (is_dir($local)) {
         throw new Engine_Vfs_Adapter_Exception(sprintf('Unable to put "%s" to "%s": directories not supported', $path, $local));
     }
     // Make sure parent exists
     if (!$this->exists(dirname($path))) {
         $this->makeDirectory(dirname($path), true);
     }
     // Get mode
     $mode = $this->getFileMode($path);
     // Non-blocking mode
     if (@function_exists('ftp_nb_put')) {
         $resource = $this->getResource();
         $res = @ftp_nb_put($resource, $path, $local, $mode);
         while ($res == FTP_MOREDATA) {
             //$this->_announce('nb_put');
             $res = @ftp_nb_continue($resource);
         }
         $return = $res === FTP_FINISHED;
     } else {
         $return = @ftp_put($this->_handle, $path, $local, $mode);
     }
     // Set umask permission
     try {
         $this->mode($path, $this->getUmask(0666));
     } catch (Exception $e) {
         // Silence
     }
     if (!$return) {
         throw new Engine_Vfs_Adapter_Exception(sprintf('Unable to put "%s" to "%s"', $path, $local));
     }
     return true;
 }
开发者ID:robeendey,项目名称:ce,代码行数:36,代码来源:Ftp.php


注:本文中的ftp_nb_put函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。