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

PHP ftp_mkdir函数代码示例

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

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



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

示例1: _copyFile

 function _copyFile($sFilePathFrom, $sFilePathTo)
 {
     if (substr($sFilePathFrom, -1) == '*') {
         $sFilePathFrom = substr($sFilePathFrom, 0, -1);
     }
     $bResult = false;
     if (is_file($sFilePathFrom)) {
         if ($this->_isFile($sFilePathTo)) {
             $aFileParts = $this->_parseFile($sFilePathTo);
             if (isset($aFileParts[0])) {
                 @ftp_mkdir($this->_rStream, $aFileParts[0]);
             }
             $bResult = @ftp_put($this->_rStream, $sFilePathTo, $sFilePathFrom, FTP_BINARY);
         } else {
             if ($this->_isDirectory($sFilePathTo)) {
                 @ftp_mkdir($this->_rStream, $sFilePathTo);
                 $aFileParts = $this->_parseFile($sFilePathFrom);
                 if (isset($aFileParts[1])) {
                     $bResult = @ftp_put($this->_rStream, $this->_validatePath($sFilePathTo) . $aFileParts[1], $sFilePathFrom, FTP_BINARY);
                 }
             }
         }
     } else {
         if (is_dir($sFilePathFrom) && $this->_isDirectory($sFilePathTo)) {
             @ftp_mkdir($this->_rStream, $sFilePathTo);
             $aInnerFiles = $this->_readDirectory($sFilePathFrom);
             foreach ($aInnerFiles as $sFile) {
                 $bResult = $this->_copyFile($this->_validatePath($sFilePathFrom) . $sFile, $this->_validatePath($sFilePathTo) . $sFile);
             }
         } else {
             $bResult = false;
         }
     }
     return $bResult;
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:35,代码来源:BxDolFtp.php


示例2: enviaImagen

function enviaImagen($fRutaImagen, $fDirServ, $fNombreImagen)
{
    $host = 'ftp.laraandalucia.com';
    $usuario = 'laraandalucia.com';
    $pass = '2525232';
    $errorFtp = 'no';
    $dirServ = 'html/images/Lara/' . $fDirServ;
    $conexion = @ftp_connect($host);
    if ($conexion) {
        if (@ftp_login($conexion, $usuario, $pass)) {
            if (!@ftp_chdir($conexion, $dirServ)) {
                if (!@ftp_mkdir($conexion, $dirServ)) {
                    $errorFtp = 'si';
                }
            }
        } else {
            $errorFtp = 'si';
        }
    } else {
        $errorFtp = 'si';
    }
    if ($errorFtp = 'no') {
        @ftp_chdir($conexion, $dirServ);
        if (@(!ftp_put($conexion, $fNombreImagen, $fRutaImagen, FTP_BINARY))) {
            $errorFtp = 'si';
        }
    }
    @ftp_quit($conexion);
    return $errorFtp == 'no';
}
开发者ID:amarser,项目名称:cmi,代码行数:30,代码来源:ManchaLlana.php


示例3: ftp_upload

function ftp_upload($servers, $users, $passs, $dirs, $source, $dest = false)
{
    for ($k = 0, reset($servers); $k < count($servers); $k++) {
        $key = key($servers);
        $server = $servers[$key];
        $user = $users[$key];
        $pass = $passs[$key];
        $dir = $dirs[$key];
        if (!$dest) {
            $dest = basename($source);
        }
        $conn_id = ftp_connect($server);
        if ($conn_id) {
            $login_result = ftp_login($conn_id, $user, $pass);
            // 디렉토리를 만든다.  상위디렉토리부터 모두 만든다.
            $dd = '';
            $d = explode("/", $dir);
            for ($i = 0; $i < count($d) - 1; $i++) {
                $dd .= $d[$i] . "/";
                @ftp_mkdir($conn_id, $dd);
            }
            @ftp_put($conn_id, $dir . $dest, $source, FTP_BINARY);
            ftp_quit($conn_id);
        }
        next($servers);
    }
}
开发者ID:kkskipper,项目名称:KNOWME,代码行数:27,代码来源:lib.php


示例4: store

 /**
  * Store it locally
  * @param  string $fullPath    Full path from local system being saved
  * @param  string $filename Filename to use on saving
  */
 public function store($fullPath, $filename)
 {
     if ($this->connection == false) {
         $result = array('error' => 1, 'message' => "Unable to connect to ftp server!");
         return $result;
     }
     //prepare dir path to be valid :)
     $this->remoteDir = rtrim($this->remoteDir, "/") . "/";
     try {
         $originalDirectory = ftp_pwd($this->connection);
         // test if you can change directory to remote dir
         // suppress errors in case $dir is not a file or not a directory
         if (@ftp_chdir($this->connection, $this->remoteDir)) {
             // If it is a directory, then change the directory back to the original directory
             ftp_chdir($this->connection, $originalDirectory);
         } else {
             if (!ftp_mkdir($this->connection, $this->remoteDir)) {
                 $result = array('error' => 1, 'message' => "Remote dir does not exist and unable to create it!");
             }
         }
         //save file to local dir
         if (!ftp_put($this->connection, $this->remoteDir . $filename, $fullPath, FTP_BINARY)) {
             $result = array('error' => 1, 'message' => "Unable to send file to ftp server");
             return $result;
         }
         //prepare and return result
         $result = array('storage_path' => $this->remoteDir . $filename);
         return $result;
     } catch (Exception $e) {
         //unable to copy file, return error
         $result = array('error' => 1, 'message' => $e->getMessage());
         return $result;
     }
 }
开发者ID:mukulmantosh,项目名称:maratus-php-backup,代码行数:39,代码来源:Ftp.php


示例5: addDir

 private function addDir($dir, $display)
 {
     $chDir = $this->targetDirectory . dirname($dir);
     $mkDir = basename($dir);
     if ($this->testMode) {
         $this->messages[] = "Test mode, Add directory, {$mkDir} to {$chDir}";
         if ($display) {
             echo end($this->messages), "\n";
         }
     } else {
         if (@ftp_chdir($this->conn_id, $chDir) === false) {
             $this->messages[] = "Could not change directory to {$chDir}";
             if ($display) {
                 echo end($this->messages), "\n";
             }
         } else {
             if (($newDir = @ftp_mkdir($this->conn_id, $mkDir)) === false) {
                 $this->messages[] = "Could not Add directory, {$mkDir} to {$chDir}";
                 if ($display) {
                     echo end($this->messages), "\n";
                 }
             } else {
                 $this->messages[] = "Add directory, {$mkDir} to {$chDir}";
                 if ($display) {
                     echo end($this->messages), "\n";
                 }
             }
         }
     }
 }
开发者ID:raxisau,项目名称:JackBooted,代码行数:30,代码来源:DeployChangeset.php


示例6: Upload

 protected function Upload($dir, $files)
 {
     global $lang;
     $sum = 0;
     foreach ($files as $key => $val) {
         $sum += $_FILES[$val]['size'];
     }
     if ($sum <= 2097152) {
         $rel_dir = 'Uploads/';
         $make_dir = FALSE;
         if (get_setting('ftp', 'use_ftp') || intval(get_setting('ftp', 'use_ftp')) == 1) {
             if ($conn_id = ftp_connect(get_setting('ftp', 'server'))) {
                 if (@ftp_login($conn_id, get_setting('ftp', 'username'), get_setting('ftp', 'password'))) {
                     @ftp_mkdir($conn_id, $rel_dir . $dir);
                     @ftp_chmod($conn_id, 0777, $rel_dir . $dir);
                     $make_dir = TRUE;
                 }
             }
         } else {
             if (@mkdir($rel_dir . $dir)) {
                 $make_dir = TRUE;
             }
         }
         if ($make_dir) {
             foreach ($files as $key => $file) {
                 @move_uploaded_file($_FILES[$file]['tmp_name'], $rel_dir . $dir . '/' . $_FILES[$file]['name']);
             }
         }
     } else {
         return SetError::Set($lang['L_ERRORFILESTOOBIG']);
     }
     return TRUE;
 }
开发者ID:BackupTheBerlios,项目名称:k4bb,代码行数:33,代码来源:posting.class.php


示例7: ftpMkDir

function ftpMkDir($path, $newDir, $ftpServer, $ftpUser, $ftpPass)
{
    $server = $ftpServer;
    // ftp server
    $connection = ftp_connect($server);
    // connection
    // login to ftp server
    $user = $ftpUser;
    $pass = $ftpPass;
    $result = ftp_login($connection, $user, $pass);
    // check if connection was made
    if (!$connection || !$result) {
        return false;
        exit;
    } else {
        ftp_chdir($connection, $path);
        // go to destination dir
        if (ftp_mkdir($connection, $newDir)) {
            // create directory
            return $newDir;
        } else {
            return false;
        }
        ftp_close($connection);
        // close connection
    }
}
开发者ID:utilo-web-app-development,项目名称:REZERVI,代码行数:27,代码来源:filesAndFolders.inc.php


示例8: ftp_check_dir

 static function ftp_check_dir($remote_dir_path, $mkdir = true)
 {
     $ret = true;
     if (self::ftp_image_connect()) {
         if ($remote_dir_path == '') {
             return true;
         }
         $dir = split("/", $remote_dir_path);
         $remote_dir_path = "";
         for ($i = 0; $i < count($dir); $i++) {
             if ($dir[$i] != '') {
                 $remote_dir_path .= "/" . $dir[$i];
                 if (!@ftp_chdir(ImageLib::$ftp_image_connect_id, $remote_dir_path)) {
                     if ($mkdir) {
                         @ftp_chdir(ImageLib::$ftp_image_connect_id, "/");
                         if (!@ftp_mkdir(ImageLib::$ftp_image_connect_id, $remote_dir_path)) {
                             $ret = false;
                             break;
                         }
                     } else {
                         $ret = false;
                         break;
                     }
                 }
             }
         }
         @ftp_chdir(ImageLib::$ftp_image_connect_id, "/");
     } else {
         $ret = false;
     }
     return $ret;
 }
开发者ID:duynhan07,项目名称:elink,代码行数:32,代码来源:ImageLib.php


示例9: putFile

 function putFile($filename)
 {
     if (!$this->connection || !$this->login_result) {
         $this->connect();
     }
     $directories = dirname($filename);
     $file = basename($filename);
     $dir_array = explode('/', $directories);
     $empty = array_shift($dir_array);
     // Change into MIRROR_REMOTE_DIR.
     ftp_chdir($this->connection, MIRROR_REMOTE_DIR);
     // Create any folders that are needed.
     foreach ($dir_array as $dir) {
         // If it doesn't exist, create it.
         // Then chdir to it.
         if (@ftp_chdir($this->connection, $dir)) {
             // Do nothing.
         } else {
             if (ftp_mkdir($this->connection, $dir)) {
                 ftp_chmod($this->connection, 0775, $dir);
                 ftp_chdir($this->connection, $dir);
             } else {
                 NDebug::debug('Cannot create a folder via ftp.', N_DEBUGTYPE_INFO);
             }
         }
     }
     // Put the file into the folder.
     $full_path = $_SERVER['DOCUMENT_ROOT'] . $filename;
     if (ftp_put($this->connection, $file, $full_path, FTP_BINARY)) {
         ftp_chmod($this->connection, 0775, $file);
         NDebug::debug("FTP Mirror: {$filename} was uploaded successfully", N_DEBUGTYPE_INFO);
     } else {
         NDebug::debug("FTP Mirror: {$filename} was NOT uploaded successfully", N_DEBUGTYPE_INFO);
     }
 }
开发者ID:nonfiction,项目名称:nterchange,代码行数:35,代码来源:ftp_mirror.php


示例10: make_collection

 public function make_collection($path)
 {
     $path = $this->get_encoded_path($path);
     if (false === ($conn = $this->get_connection_handle())) {
         throw new Exception("Could not connect to FTP server.");
     }
     if ('/' == $path[0]) {
         $path = substr($path, 1);
     }
     if ('/' == substr($path, -1)) {
         $path = substr($path, 0, -1);
     }
     $path_parts = explode('/', $path);
     for ($i = 0; $i < sizeof($path_parts) - 1; $i++) {
         if (false === @ftp_chdir($conn, $path_parts[$i])) {
             $this->throw_exception("Could not change to directory `{$path_parts[$i]}'.");
         }
     }
     $label = $path_parts[sizeof($path_parts) - 1];
     if (false === @ftp_mkdir($conn, $label)) {
         $this->throw_exception("Could not make directory `{$label}'.");
     }
     @ftp_close($conn);
     return true;
 }
开发者ID:aprilchild,项目名称:aprilchild,代码行数:25,代码来源:ftp_client.php


示例11: subida_script

function subida_script($ftp_server, $ftp_user, $ftp_pass)
{
    // set up basic connection
    $conn_id = ftp_connect($ftp_server);
    if (!$conn_id) {
        echo "<div class='alert alert-warning' style='width:300px;margin:auto'>Connection established</div>";
    }
    // login with username and password
    $login_result = ftp_login($conn_id, $ftp_user, $ftp_pass);
    if ($login_result) {
        echo "<div class='alert alert-success' style='width:300px;margin:auto'>Connection established</div>";
    }
    ftp_chdir($conn_id, 'public_html');
    ftp_mkdir($conn_id, 'search');
    ftp_chdir($conn_id, 'search');
    ftp_mkdir($conn_id, 'css');
    ftp_chdir($conn_id, 'css');
    echo ftp_pwd($conn_id);
    ftp_chdir($conn_id, '../../autotienda/search');
    echo ftp_pwd($conn_id);
    //Uploading files...
    //to be uploaded
    $file = "search/.htaccess";
    $fp = fopen($file, 'r');
    ftp_fput($conn_id, $file, $fp, FTP_ASCII);
    echo ftp_pwd($conn_id);
    // close the connection
    ftp_close($conn_id);
    fclose($fp);
}
开发者ID:nuwem,项目名称:fitness,代码行数:30,代码来源:libconfig.php


示例12: listDir

 function listDir($conn, $dirname, $ftpdir)
 {
     $dirs = array();
     $files = array();
     set_time_limit(0);
     $dir = opendir($dirname);
     while (($file = readdir($dir)) != false) {
         if ($file == "." || $file == "..") {
             continue;
         }
         if (is_dir($dirname . "/" . $file)) {
             array_push($dirs, $dirname . "/" . $file);
             //目录不存在,则新建。
             if ($this->isdir($conn, $ftpdir, $file)) {
                 ftp_chdir($conn, $ftpdir);
             } else {
                 ftp_mkdir($conn, $ftpdir . "/" . $file);
                 echo "创建目录---->{$file}---成功! <br/>";
             }
             $this->listDir($conn, $dirname . "/" . $file, $ftpdir . "/" . $file);
         } else {
             array_push($files, $ftpdir . "/" . $file);
             ftp_chdir($conn, $ftpdir);
             if ($this->endsWith($file, ".jpg") || $this->endsWith($file, ".png") || $this->endsWith($file, ".gif") || $this->endsWith($file, ".exe") || $this->endsWith($file, ".zip") || $this->endsWith($file, ".swf") || $this->endsWith($file, ".db") || $this->endsWith($file, ".dll") || $this->endsWith($file, ".PHP") || $this->endsWith($file, ".INI") || $this->endsWith($file, ".js") || $this->endsWith($file, ".css") || $this->endsWith($file, ".zip") || $this->endsWith($file, ".rar") || $this->endsWith($file, ".xml") || $this->endsWith($file, ".html") || $this->endsWith($file, ".doc") || $this->endsWith($file, ".TXT")) {
                 $upload = ftp_put($conn, $file, $dirname . "/" . $file, FTP_BINARY);
             } else {
                 $upload = ftp_put($conn, $file, $dirname . "/" . $file, FTP_ASCII);
                 echo "上传文件--->{$dirname}/{$file} ------成功! <br/>";
             }
         }
     }
 }
开发者ID:tiantuikeji,项目名称:fy,代码行数:32,代码来源:141231094404.PHP


示例13: createDirectory

 public function createDirectory($remoteDir)
 {
     // Require a connection and a login
     $this->validateState();
     $remoteDir = $this->buildAbsolutePath($remoteDir);
     return @ftp_mkdir($this->ftpResource, $remoteDir);
 }
开发者ID:codeaken,项目名称:ftpclient,代码行数:7,代码来源:FtpClient.php


示例14: preparePath

 private function preparePath($subfolder)
 {
     if (!ftp_chdir($this->stream, $this->path)) {
         $this->throwException('Cannot change directory to path "%s"', $this->path);
     }
     $p = $path = $this->path . $subfolder;
     $folders = array();
     while ($p != $this->path) {
         if (!ftp_chdir($this->stream, $p)) {
             $folders[] = basename($p);
             $p = dirname($p);
         } else {
             krsort($folders);
             foreach ($folders as $folder) {
                 $p .= '/' . $folder;
                 if (!ftp_mkdir($this->stream, $p)) {
                     $this->throwException('Cannot create path "%s"', $p);
                 }
                 ftp_chmod($this->stream, 0777, $p);
             }
             break;
         }
     }
     ftp_chdir($this->stream, $path);
 }
开发者ID:windieselz,项目名称:php-remote-image-uploader,代码行数:25,代码来源:Host.php


示例15: mmkdir

 function mmkdir($directory)
 {
     if (!$this->conn_id) {
         return false;
     }
     return @ftp_mkdir($this->conn_id, $directory);
 }
开发者ID:polarlight1989,项目名称:08cms,代码行数:7,代码来源:ftp.fun.php


示例16: createFolder

 public function createFolder(string $path) : bool
 {
     if (ftp_mkdir($this->connect, $path)) {
         return true;
     } else {
         throw new FolderAllreadyException($path);
     }
 }
开发者ID:znframework,项目名称:znframework,代码行数:8,代码来源:Forge.php


示例17: mkdir

 /**
  * Create a directory
  *
  * @param string $strDirectory The directory name
  *
  * @return boolean True if the operation was successful
  */
 public function mkdir($strDirectory)
 {
     $this->connect();
     $this->validate($strDirectory);
     $return = @ftp_mkdir($this->resConnection, \Config::get('ftpPath') . $strDirectory) ? true : false;
     $this->chmod($strDirectory, \Config::get('defaultFolderChmod'));
     return $return;
 }
开发者ID:StephenGWills,项目名称:sample-contao-app,代码行数:15,代码来源:Ftp.php


示例18: addDir

 public function addDir($dir)
 {
     if (is_resource($this->connection)) {
         return ftp_mkdir($this->connection, $dir);
     } else {
         return false;
     }
 }
开发者ID:natgeo,项目名称:kids-myshot,代码行数:8,代码来源:ftp.php


示例19: CreateDir

 public function CreateDir($path, $permition)
 {
     if (ftp_mkdir($this->connection, $path) == false) {
         error_log('[FTP] Could not create directory ' . $path . '');
     } else {
         $this->ChangePermission($path, $permition);
     }
 }
开发者ID:NejcZdovc,项目名称:sumo2,代码行数:8,代码来源:ftp.class.php


示例20: mkdir

 public function mkdir($dest)
 {
     $pwd = dirname($dest);
     if (false === $this->exists($pwd)) {
         $this->mkdir($pwd);
     }
     $this->dispatcher->dispatch(TransporterEvents::TRANSPORTER_MKDIR, new TransporterEvent($this, $dest));
     ftp_mkdir($this->stream, $dest);
 }
开发者ID:webcreate,项目名称:conveyor,代码行数:9,代码来源:FtpTransporter.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP ftp_nb_continue函数代码示例发布时间:2022-05-15
下一篇:
PHP ftp_mdtm函数代码示例发布时间: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