• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP ftp_nb_continue函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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


示例2: download

 /**
  * FTP-文件下载
  *
  * @param string  $local_file 本地文件
  * @param string  $ftp_file Ftp文件
  *
  * @return bool
  */
 public function download($local_file, $ftp_file)
 {
     if (empty($local_file) || empty($ftp_file)) {
         return false;
     }
     $ret = ftp_nb_get($this->linkid, $local_file, $ftp_file, FTP_BINARY);
     while ($ret == FTP_MOREDATA) {
         $ret = ftp_nb_continue($this->linkid);
     }
     if ($ret != FTP_FINISHED) {
         return false;
     }
     return true;
 }
开发者ID:phpdn,项目名称:framework,代码行数:22,代码来源:Ftp.php


示例3: 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


示例4: __construct

 /**
  * Construct the routine that must be run.
  *
  * @param  array  $files  Files to upload
  * @param  array  $options  FTP Connection options.
  *
  * @return  void
  */
 public function __construct($files, $options = [])
 {
     parent::__construct();
     $this->_sig_complete = new SIG_Complete();
     $this->_sig_failure = new SIG_Failure();
     $this->_sig_finished = new SIG_Finished($this);
     $defaults = ['hostname' => null, 'port' => 21, 'timeout' => 90, 'username' => null, 'password' => null, 'secure' => false];
     $this->_files = $files;
     $options += $defaults;
     $this->_options = $options;
     /**
      * Upload Idle process
      */
     $this->_idle = new Process(function () {
         $this->_init_transfers();
         foreach ($this->_uploading as $_key => $_file) {
             $status = ftp_nb_continue($_file[0]);
             if ($status === FTP_MOREDATA) {
                 continue;
             }
             if ($status === FTP_FINISHED) {
                 $this->_sig_complete->set_upload($_file[1]);
                 xp_emit($this->_sig_complete);
                 // Close the FTP connection to that file
                 ftp_close($_file[0]);
                 $this->_uploaded[] = $_file[1];
             } else {
                 $this->_sig_failure->set_upload($_file[1]);
                 xp_emit($this->_sig_failure);
                 // Close the FTP connection to that file
                 ftp_close($_file[0]);
             }
             unset($this->_uploading[$_key]);
         }
         // Cleanup once finished
         if (count($this->_uploading) == 0) {
             xp_emit($this->_sig_finished);
             xp_delete_signal($this);
             xp_delete_signal($this->_sig_complete);
             xp_delete_signal($this->_sig_failure);
         }
     });
     // Init
     xp_emit($this);
 }
开发者ID:prggmr,项目名称:xpspl,代码行数:53,代码来源:sig_upload.php


示例5: download_xu

 /**
  * XU_Ftp::download_xu()
  *
  * Download a file
  *
  * @access  public
  * @param   string	$remote_file	Remote filename
  * @param   string	$fid			File ID
  * @param   bool	$max_size		Max file size
  * @return  bool
  */
 public function download_xu($remote_file, $fid, $max_size)
 {
     if (!$this->_is_conn()) {
         return FALSE;
     }
     $result = TRUE;
     // if no filepointer is given, make a temp file and open it for writing
     $tmpfname = tempnam(ROOTPATH . '/temp', "RFT-");
     $l_fp = fopen($tmpfname, "wb");
     // Initate the download
     $i = 0;
     $CI =& get_instance();
     $ret = ftp_nb_fget($this->conn_id, $l_fp, $remote_file, FTP_BINARY);
     while ($ret == FTP_MOREDATA) {
         if ($i % 10 == 0) {
             $fstat = fstat($l_fp);
             $p = $fstat[7];
             $CI->db->where('fid', $fid);
             $CI->db->update('progress', array('progress' => $p, 'curr_time' => time()));
         }
         // Continue downloading...
         $ret = ftp_nb_continue($this->conn_id);
         $i++;
     }
     // Has it finished completly?
     if ($ret != FTP_FINISHED) {
         log_message('error', "FTP TRANSFER FAILED");
         $result = FALSE;
     }
     if ($result === FALSE) {
         if ($this->debug == TRUE) {
             $msg = 'ftp_unable_to_download';
             $this->_error($msg);
         } else {
             $this->error = TRUE;
             $this->error_msg = 'ftp_unable_to_download';
         }
         return FALSE;
     }
     return $tmpfname;
 }
开发者ID:rexcarnation,项目名称:XtraUpload-1,代码行数:52,代码来源:XU_Ftp.php


示例6: isbusy

 function isbusy()
 {
     $result = false;
     do {
         if (self::$ret != FTP_MOREDATA) {
             break;
         }
         self::$ret = @ftp_nb_continue(self::$cid);
         switch (self::$ret) {
             case FTP_MOREDATA:
                 clearstatcache();
                 $size = filesize(self::$temp_file);
                 if (self::$size == $size && ++self::$counts > 10) {
                     self::$size = 0;
                     self::$counts = 0;
                     self::close();
                     break 2;
                 }
                 self::$size = $size;
                 return true;
             case FTP_FINISHED:
                 self::$size = 0;
                 self::$counts = 0;
                 rename(self::$temp_file, self::$local_file);
                 self::close();
                 $result = true;
                 break 2;
             default:
                 // FTP_FAILED
                 self::$size = 0;
                 self::$counts = 0;
                 self::halt("Lost connection to FTP server during query");
                 break 2;
         }
     } while (false);
     if (self::$fp) {
         fclose(self::$fp);
         self::$fp = NULL;
     }
     return $result;
 }
开发者ID:phateio,项目名称:php-radio-kernel,代码行数:41,代码来源:db_ftp.class.php


示例7: AsynchronouslyContinue

 /**
  * @return int
  */
 public function AsynchronouslyContinue()
 {
     return ftp_nb_continue($this->getFtp());
 }
开发者ID:acassan,项目名称:remoteserver,代码行数:7,代码来源:Ftp.php


示例8: nbContinue

 /**
  * Continues retrieving/sending a file (non-blocking)
  * @link http://php.net/ftp_nb_continue
  *
  * @return integer FTPWrapper::FAILED, FTPWrapper::FINISHED or FTPWrapper::MOREDATA
  */
 public function nbContinue()
 {
     return ftp_nb_continue($this->connection->getStream());
 }
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:10,代码来源:FTPWrapper.php


示例9: 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


示例10: get

 public function get($local_file_path, $remote_file_path, $mode = FTP_BINARY, $resume = false, $updraftplus = false)
 {
     $file_last_size = 0;
     if ($resume) {
         if (!($fh = fopen($local_file_path, 'ab'))) {
             return false;
         }
         clearstatcache($local_file_path);
         $file_last_size = filesize($local_file_path);
     } else {
         if (!($fh = fopen($local_file_path, 'wb'))) {
             return false;
         }
     }
     $ret = ftp_nb_fget($this->conn_id, $fh, $remote_file_path, $mode, $file_last_size);
     if (false == $ret) {
         return false;
     }
     while ($ret == FTP_MOREDATA) {
         if ($updraftplus) {
             $file_now_size = filesize($local_file_path);
             if ($file_now_size - $file_last_size > 524288) {
                 $updraftplus->log("FTP fetch: file size is now: " . sprintf("%0.2f", filesize($local_file_path) / 1048576) . " Mb");
                 $file_last_size = $file_now_size;
             }
             clearstatcache($local_file_path);
         }
         $ret = ftp_nb_continue($this->conn_id);
     }
     fclose($fh);
     if ($ret == FTP_FINISHED) {
         if ($updraftplus) {
             $updraftplus->log("FTP fetch: fetch complete");
         }
         return true;
     } else {
         if ($updraftplus) {
             $updraftplus->log("FTP fetch: fetch failed");
         }
         return false;
     }
 }
开发者ID:erikdukker,项目名称:medisom,代码行数:42,代码来源:ftp.class.php


示例11: 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


示例12: get_htaccess

function get_htaccess($ftp_handle, $dir)
{
    $local_htaccess = tempnam("files", "down");
    $ftp_htaccess = str_replace("//", "/", $dir . '/.htaccess');
    $ret = @ftp_nb_get($ftp_handle, $local_htaccess, $ftp_htaccess, FTP_BINARY);
    while ($ret == FTP_MOREDATA) {
        // Продолжаем загрузку
        $ret = @ftp_nb_continue($ftp_handle);
    }
    @chmod($local_htaccess, 0644);
    $content = @file_get_contents($local_htaccess);
    @unlink($local_htaccess);
    return $content;
}
开发者ID:volhali,项目名称:mebel,代码行数:14,代码来源:uitls.htfiles.php


示例13: ftp_connect

<?php

require 'server.inc';
$file = "mediumfile.txt";
$ftp = ftp_connect('127.0.0.1', $port);
ftp_login($ftp, 'user', 'pass');
if (!$ftp) {
    die("Couldn't connect to the server");
}
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . $file;
touch($local_file);
$r = ftp_nb_get($ftp, $local_file, $file, FTP_BINARY);
while ($r == FTP_MOREDATA) {
    $r = ftp_nb_continue($ftp);
}
ftp_close($ftp);
echo file_get_contents($local_file);
error_reporting(0);
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "mediumfile.txt");
开发者ID:badlamer,项目名称:hhvm,代码行数:19,代码来源:ftp_nb_continue.php


示例14: put

 public function put($local_file, $remote_file, $overwrite = false, $mode = null, $options = 0)
 {
     if ($options & (FILE_FTP_BLOCKING | FILE_FTP_NONBLOCKING) === (FILE_FTP_BLOCKING | FILE_FTP_NONBLOCKING)) {
         throw new FTPException("Bad options given: FILE_FTP_NONBLOCKING and '. 'FILE_FTP_BLOCKING can't both be set");
     }
     $usenb = !($options & FILE_FTP_BLOCKING == FILE_FTP_BLOCKING);
     if (!isset($mode)) {
         $mode = $this->checkFileExtension($local_file);
     }
     $remote_file = $this->constructPath($remote_file);
     if (!file_exists($local_file)) {
         throw new FTPException("Local file '{$local_file}' does not exist.");
     }
     if (ftp_size($this->handle, $remote_file) != -1 && !$overwrite) {
         throw new FTPException("Remote file '" . $remote_file . "' exists and may not be overwriten.");
     }
     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) {
             $res = ftp_nb_continue($this->handle);
         }
     } else {
         $res = ftp_put($this->handle, $remote_file, $local_file, $mode);
     }
     if (!$res) {
         throw new FTPException("File '{$local_file}' could not be uploaded to '" . $remote_file . "'.");
     }
     return true;
 }
开发者ID:shaunfreeman,项目名称:Uthando-CMS,代码行数:32,代码来源:FTP.php


示例15: nb_get

 protected function nb_get($localfile, $remotefile, $start = FTP_AUTORESUME)
 {
     clearstatcache();
     if (!file_exists($localfile)) {
         $start = 0;
     }
     $ret = @ftp_nb_get($this->connexion, $localfile, $remotefile, FTP_BINARY, $start);
     while ($ret === FTP_MOREDATA) {
         set_time_limit(20);
         $ret = ftp_nb_continue($this->connexion);
     }
     return $ret;
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:13,代码来源:ftpclient.php


示例16: readLog

 /** Reads the log.
  * This function reads all the remaining log since last read (paying no attention to line returns). It also downloads it from an FTP server if specified.
  * 
  * \return The read data if averything passed correctly, FALSE otherwise. If no data has been read, it returns an empty string.
  */
 public function readLog()
 {
     switch ($this->_logfile['type']) {
         case 'ftp':
             //If we have finished to download the log, we read it and restart downloading
             if ($this->_logfile['state'] == FTP_FINISHED) {
                 $data = '';
                 //We read only if the pointer has changed, i.e. something has been downloaded.
                 if ($this->_logfile['pointer'] != ftell($this->_logfile['fp'])) {
                     fseek($this->_logfile['fp'], $this->_logfile['pointer']);
                     //Reset file pointer to last read position (ftp_nb_fget moves the pointer)
                     $data = '';
                     $read = NULL;
                     while ($read === NULL || $read) {
                         $read = fread($this->_logfile['fp'], 1024);
                         $data .= $read;
                     }
                     $this->_logfile['pointer'] = ftell($this->_logfile['fp']);
                     //Save new pointer position
                 }
                 //Calculation of new global pointer and sending command
                 $totalpointer = $this->_logfile['pointer'] + $this->_logfile['origpointer'];
                 $this->_logfile['state'] = ftp_nb_fget($this->_logfile['ftp'], $this->_logfile['fp'], $this->_logfile['location'], FTP_BINARY, $totalpointer);
                 return $data;
             } elseif ($this->_logfile['state'] == FTP_FAILED) {
                 Leelabot::message('Can\'t read the remote FTP log anymore.', array(), E_WARNING);
                 $this->openLogFile(TRUE);
                 return FALSE;
             } else {
                 $this->_logfile['state'] = ftp_nb_continue($this->_logfile['ftp']);
             }
             break;
         case 'file':
             $data = '';
             $read = NULL;
             while ($read === NULL || $read) {
                 $read = fread($this->_logfile['fp'], 1024);
                 $data .= $read;
             }
             return $data;
             break;
     }
 }
开发者ID:Geolim4,项目名称:Leelabot,代码行数:48,代码来源:instance.class.php


示例17: 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


示例18: pull

 /**
  * FTP中文件下载到本地
  *
  * @params array $params 参数 array('local'=>'本地文件路径','remote'=>'远程文件路径','resume'=>'文件指针位置')
  * @params string $msg 
  * @return bool 
  */
 public function pull($params, &$msg)
 {
     if ($this->ftp_extension) {
         $ret = ftp_nb_get($this->conn, $params['local'], $params['remote'], $this->mode, $params['resume']);
         while ($ret == FTP_MOREDATA) {
             $ret = ftp_nb_continue($this->conn);
         }
     } else {
         $ret = $this->ftpclient->download($params['remote'], $params['local'], $this->mode, $params['resume']);
     }
     if ($ret == FTP_FAILED || $ret === false) {
         $msg = app::get('importexport')->_('FTP下载文件失败');
         return false;
     }
     return true;
 }
开发者ID:453111208,项目名称:bbc,代码行数:23,代码来源:ftp.php


示例19: putContents

 public function putContents($path, $data)
 {
     $path = $this->path($path);
     // Create stack buffer
     Engine_Stream_Stack::registerWrapper();
     $stack = @fopen('stack://tmp', 'w+');
     if (!$stack) {
         throw new Engine_Vfs_Adapter_Exception(sprintf('Unable to create stack buffer'));
     }
     // Write into stack
     $len = 0;
     do {
         $tmp = @fwrite($stack, substr($data, $len));
         $len += $tmp;
     } while (strlen($data) > $len && $tmp != 0);
     // Get mode
     $mode = $this->getFileMode($path);
     // Non-blocking mode
     if (@function_exists('ftp_nb_fput')) {
         $resource = $this->getResource();
         $res = @ftp_nb_fput($resource, $path, $stack, $mode);
         while ($res == FTP_MOREDATA) {
             //$this->_announce('nb_get');
             $res = @ftp_nb_continue($resource);
         }
         $return = $res === FTP_FINISHED;
     } else {
         $return = @ftp_fput($this->_handle, $path, $stack, $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 contents to "%s"', $path));
     }
     return true;
 }
开发者ID:robeendey,项目名称:ce,代码行数:40,代码来源:Ftp.php


示例20: nbContinue

 /**
  *
  * 连续获取/发送文件(non-blocking)
  * 以不分块的方式连续获取/发送一个文件。
  *
  * @return int 返回常量 FTP_FAILED 或 FTP_FINISHED 或 FTP_MOREDATA
  */
 public static function nbContinue()
 {
     return ftp_nb_continue(self::$resource);
 }
开发者ID:luozhanhong,项目名称:share,代码行数:11,代码来源:ftp.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ftp_nb_fget函数代码示例发布时间:2022-05-15
下一篇:
PHP ftp_mkdir函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap