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


PHP ftp_site函数代码示例

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


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

示例1: ftp_file

/**
* FTP File to Location
*/
function ftp_file($source_file, $dest_file, $mimetype, $disable_error_mode = false)
{
    global $config, $lang, $error, $error_msg;
    $conn_id = attach_init_ftp();
    // Binary or Ascii ?
    $mode = FTP_BINARY;
    if (preg_match("/text/i", $mimetype) || preg_match("/html/i", $mimetype)) {
        $mode = FTP_ASCII;
    }
    $res = @ftp_put($conn_id, $dest_file, $source_file, $mode);
    if (!$res && !$disable_error_mode) {
        $error = true;
        if (!empty($error_msg)) {
            $error_msg .= '<br />';
        }
        $error_msg = sprintf($lang['Ftp_error_upload'], $config['ftp_path']) . '<br />';
        @ftp_quit($conn_id);
        return false;
    }
    if (!$res) {
        return false;
    }
    @ftp_site($conn_id, 'CHMOD 0644 ' . $dest_file);
    @ftp_quit($conn_id);
    return true;
}
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:29,代码来源:functions_posting.php

示例2: TpDbgSend

function TpDbgSend($inMsg)
{
    global $TpDbg;
    if ($inMsg != '') {
        @ftp_site($TpDbg, $inMsg);
    }
}
开发者ID:JeffersonFSilva,项目名称:turbophp,代码行数:7,代码来源:TpDebug.php

示例3: upload

 function upload($file, $filename)
 {
     $this->connect();
     $this->dir = FTP_DIR . $filename;
     $upload = ftp_put($this->conid, $this->dir, $file, FTP_BINARY);
     $ch = ftp_site($this->conid, "chmod 777 " . $this->dir);
     $this->disconnect();
 }
开发者ID:sovcn,项目名称:Sovereign-Clan-Manager,代码行数:8,代码来源:ftp.php

示例4: FtpMkdir

 function FtpMkdir($truepath, $mmode, $isMkdir = true)
 {
     global $cfg_basedir, $cfg_ftp_root, $g_ftpLink;
     OpenFtp();
     $ftproot = preg_replace('/' . $cfg_ftp_root . '$/', '', $cfg_basedir);
     $mdir = preg_replace('/^' . $ftproot . '/', '', $truepath);
     if ($isMkdir) {
         ftp_mkdir($g_ftpLink, $mdir);
     }
     return ftp_site($g_ftpLink, "chmod {$mmode} {$mdir}");
 }
开发者ID:ahmatjan,项目名称:cmf2,代码行数:11,代码来源:file.helper.php

示例5: ftp_chmod

 function ftp_chmod($ftpstream, $chmod, $file)
 {
     $old = error_reporting();
     //save old
     error_reporting(0);
     //set to none
     $result = ftp_site($ftpstream, "CHMOD " . intval($chmod, 8) . " " . $file);
     error_reporting($old);
     //reset to old
     return $result;
     //will result TRUE or FALSE
 }
开发者ID:phpMyChat-Plus,项目名称:phpmychat-plus,代码行数:12,代码来源:install.php

示例6: chmod

 public function chmod($mode, $file)
 {
     if ($this->_ftpStream) {
         if (function_exists('ftp_chmod')) {
             return ftp_chmod($this->_ftpStream, $mode, $file);
         } else {
             //echo "<h1>$file</h1>";
             return ftp_site($this->_ftpStream, "chmod {$mode} {$file}");
             //return ftp_exec($this->ftpStream, "chmod $mode $file");
         }
     }
     return false;
 }
开发者ID:ssrsfs,项目名称:blg,代码行数:13,代码来源:Ftp.php

示例7: rcms_ftp_mkdir

function rcms_ftp_mkdir($dir, $server, $username, $password, $path)
{
    if (!is_dir(dirname($dir))) {
        rcms_ftp_mkdir(dirname($dir));
    }
    $ftp = ftp_connect($server);
    ftp_login($ftp, $username, $password);
    if (RCMS_ROOT_PATH == '../') {
        $path .= 'admin/';
    }
    ftp_mkdir($ftp, $path . $dir);
    ftp_site($ftp, 'CHMOD 0777 ' . $path . $dir);
    ftp_close($ftp);
    return true;
}
开发者ID:l1ght13aby,项目名称:Ubilling,代码行数:15,代码来源:filesystem.php

示例8: set_permission

 function set_permission($file, $mode)
 {
     $myreturn = '';
     if ($this->op_mode == 'disk') {
         $myreturn = @chmod($file, $mode);
     } elseif ($this->op_mode == 'ftp') {
         $file = str_replace(_BASEPATH_ . '/', _FTPPATH_, $file);
         $old_de = ini_get('display_errors');
         ini_set('display_errors', 0);
         if (function_exists('ftp_chmod')) {
             $myreturn = @ftp_chmod($this->ftp_id, $mode, $file);
         } else {
             $myreturn = ftp_site($this->ftp_id, "CHMOD {$mode} {$file}");
         }
         ini_set('display_errors', $old_de);
     }
 }
开发者ID:babae,项目名称:etano,代码行数:17,代码来源:fileop.class.php

示例9: upload_video

function upload_video($flv, $ip, $username, $password, $ftp_root)
{
    $conn_id = ftp_connect($ip);
    $ftp_login = ftp_login($conn_id, $username, $password);
    if (!$conn_id or !$ftp_login) {
        die('Failed to connect to FTP server!');
    }
    ftp_pasv($conn_id, 1);
    if (!ftp_chdir($conn_id, $ftp_root)) {
        die('Failed to change directory to: ' . $ftp_root);
    }
    if (file_exists($flv)) {
        $filename = basename($flv);
        ftp_delete($conn_id, $filename);
        ftp_put($conn_id, $filename, $flv, FTP_BINARY);
        ftp_site($conn_id, sprintf('CHMOD %u %s', 777, $filename));
    }
    ftp_close($conn_id);
}
开发者ID:humor-zo,项目名称:chaofan,代码行数:19,代码来源:function_server.php

示例10: copyFileViaFtp

function copyFileViaFtp($sourcePath, $destinationPath, $connectionId)
{
    $errorMessage = '';
    $sourcePath = str_replace(" ", "-", $sourcePath);
    $destinationPath = sanitiseFtpPath($destinationPath);
    if (@(!ftp_mkdir($connectionId, $destinationPath))) {
        $errorMessage .= "&error-ftp-unable-to-create-directory; " . $destinationPath . "\n";
    }
    @ftp_site($connectionId, 'CHMOD 0777 ' . $destinationPath);
    // non-Unix-based servers may respond with "Command not implemented for that parameter" as they don't support chmod, so don't display any errors of this command.
    ftp_chdir($connectionId, $destinationPath);
    //print $sourcePath.' to '.$destinationPath."<br />";
    if (is_dir($sourcePath)) {
        chdir($sourcePath);
        $handle = opendir('.');
        while (($file = readdir($handle)) !== false) {
            if ($file != "." && $file != "..") {
                if (is_dir($file)) {
                    $errorMessage .= copyFileViaFtp($sourcePath . DIRECTORY_SEPARATOR . $file, $file, $connectionId);
                    chdir($sourcePath);
                    if (!ftp_cdup($connectionId)) {
                        $errorMessage .= '&error-unable-ftp-cd-up;';
                    }
                } else {
                    if (substr($file, strlen($file) - 4, 4) != '.zip') {
                        $fp = fopen($file, 'r');
                        if (!ftp_fput($connectionId, sanitiseFtpPath($file), $fp, FTP_BINARY)) {
                            $errorMessage .= '&error-unable-ftp-fput;';
                        }
                        @ftp_site($connectionId, 'CHMOD 0755 ' . sanitiseFtpPath($file));
                        fclose($fp);
                    }
                }
            }
        }
        closedir($handle);
    }
    return $errorMessage;
}
开发者ID:Nolfneo,项目名称:docvert,代码行数:39,代码来源:ftp.php

示例11: connect

 function connect()
 {
     if (file_exists(__DIR__ . "/../fups_connects/" . sha1($this->location) . ".json")) {
         $fups = json_decode(file_get_contents(__DIR__ . "/../fups_connects/" . sha1($this->location) . ".json"), true);
         $this->host = $fups['connection']['host'];
         $this->login = $fups['connection']['login'];
         $this->password = $fups['connection']['password'];
         $this->dir = $fups['dir'];
         $this->port = $fups['connection']['port'];
         $connection = ftp_connect($this->host, $this->port) or die($this->red . "Cannot connect to host" . $this->messageEnd);
         ftp_login($connection, $this->login, $this->password) or die($this->red . "Cannot login" . $this->messageEnd);
         if (ftp_site($connection, sprintf('CHMOD %o %s', 0777, $this->dir))) {
             $this->connection = $connection;
         } else {
             echo $this->red . "No " . $this->dir . " @ " . $this->host . $this->messageEnd;
             exit;
         }
     } else {
         echo $this->red . "No fups connection file for " . $this->location . $this->messageEnd;
         exit;
     }
     return;
 }
开发者ID:piotrkabacinski,项目名称:fups,代码行数:23,代码来源:fups.class.php

示例12: FTP_RestoreMode

 /**
  * Restore the mode of the root directory to it's original mode
  *
  */
 public function FTP_RestoreMode()
 {
     global $install_ftp_connection, $langmessage;
     if (!$this->root_mode || !$install_ftp_connection) {
         return;
     }
     $mode = $this->root_mode & 0777;
     $mode = '0' . decoct($mode);
     $ftp_cmd = 'CHMOD ' . $mode . ' ' . $this->ftp_root;
     if (!ftp_site($install_ftp_connection, $ftp_cmd)) {
         echo '<li><span class="failed">';
         echo sprintf($langmessage['Could_Not_'], '<em>Restore mode for ' . $this->ftp_root . ': ' . $ftp_cmd . '</em>');
         echo '</span></li>';
         return;
     }
 }
开发者ID:Bouhnosaure,项目名称:Typesetter,代码行数:20,代码来源:install.php

示例13: restart

 /**
  * Method to restart data transfer at a given byte
  *
  * @access public
  * @param int $point Byte to restart transfer at
  * @return boolean True if successful
  */
 function restart($point)
 {
     // If native FTP support is enabled lets use it...
     if (FTP_NATIVE) {
         if (@ftp_site($this->_conn, 'REST ' . $point) === false) {
             JError::raiseWarning('35', JText::_('JLIB_CLIENT_ERROR_JFTP_RESTART_BAD_RESPONSE_NATIVE'));
             return false;
         }
         return true;
     }
     // Send restart command and verify success
     if (!$this->_putCmd('REST ' . $point, 350)) {
         JError::raiseWarning('35', JText::sprintf('JLIB_CLIENT_ERROR_JFTP_RESTART_BAD_RESPONSE', $this->_response, $point));
         return false;
     }
     return true;
 }
开发者ID:akksi,项目名称:jcg,代码行数:24,代码来源:ftp.php

示例14: site

 /**
  * Sends a SITE command request to the FTP server.
  *
  * @param string    $command       FTP command (does not include <strong>SITE</strong> word).
  *
  * @throws FtpException If command execution fails.
  */
 public function site($command)
 {
     $this->connectIfNeeded();
     $this->param = "SITE " . $command;
     if (!ftp_site($this->handle, $command)) {
         throw new FtpException(Yii::t('gftp', 'Could not execute command "{command}" on "{host}"', ['host' => $this->host, '{command}' => $this->param]));
     }
 }
开发者ID:komaspieler,项目名称:yii2-gftp,代码行数:15,代码来源:FtpDriver.php

示例15: site

 public function site($command)
 {
     $ret = @ftp_site($this->getResource(), $command);
     if (!$ret) {
         throw new Engine_Vfs_Adapter_Exception(sprintf('Unable to execute SITE command: %s', $command));
     }
     return $ret;
 }
开发者ID:robeendey,项目名称:ce,代码行数:8,代码来源:Ftp.php


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