本文整理汇总了PHP中ftp_rename函数的典型用法代码示例。如果您正苦于以下问题:PHP ftp_rename函数的具体用法?PHP ftp_rename怎么用?PHP ftp_rename使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ftp_rename函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: rename
/**
* {@inheritDoc}
*/
public function rename($sourceKey, $targetKey)
{
$sourcePath = $this->computePath($sourceKey);
$targetPath = $this->computePath($targetKey);
$this->ensureDirectoryExists(dirname($targetPath), true);
return ftp_rename($this->getConnection(), $sourcePath, $targetPath);
}
开发者ID:saberyounis,项目名称:Sonata-Project,代码行数:10,代码来源:Ftp.php
示例2: ftp_rename
public function ftp_rename($old_file, $new_file)
{
if (!$this->ftp_conn) {
return false;
}
return @ftp_rename($this->ftp_conn, $old_file, $new_file);
}
开发者ID:Calit2-UCI,项目名称:IoT_Map,代码行数:7,代码来源:ftp_model.php
示例3: rename
public function rename(string $oldName, string $newName) : bool
{
if (ftp_rename($this->connect, $oldName, $newName)) {
return true;
} else {
throw new FolderChangeNameException($oldName);
}
}
开发者ID:znframework,项目名称:znframework,代码行数:8,代码来源:Forge.php
示例4: internalMove
/**
* {@inheritdoc}
*
* @param string $oldAssetFile
* @param string $newAssetFile
* @return bool
* @throws AssetMoveException
*/
protected function internalMove($oldAssetFile, $newAssetFile)
{
$this->reconnectIfNeeded();
if (!ftp_rename($this->connection, $oldAssetFile, $newAssetFile)) {
throw new AssetMoveException(sprintf("Unable to move '%s' to '%s'.", $oldAssetFile, $newAssetFile));
}
return $newAssetFile;
}
开发者ID:Akhoris,项目名称:asset,代码行数:16,代码来源:FtpClient.php
示例5: RenombraArchivo
function RenombraArchivo($anterior, $nuevo, $servidor, $puerto, $usuario, $password)
{
$id_ftp = ConectarFTP($servidor, $puerto, $usuario, $password);
//Obtiene un manejador y se conecta al Servidor FTP
$quepaso = ftp_rename($id_ftp, $anterior, $nuevo);
ftp_quit($id_ftp);
//Cierra la conexion FTP
return $quepaso;
}
开发者ID:AndyRocioGtz,项目名称:Registros,代码行数:9,代码来源:ftpfunc.php
示例6: ftpRename
protected function ftpRename($old, $new)
{
$result;
$conn_id = ftp_connect(FTP_SERVER);
$login_result = ftp_login($conn_id, FTP_USER_NAME, FTP_USER_PASS);
$result = ftp_rename($conn_id, $old, $new);
ftp_close($conn_id);
return $result;
}
开发者ID:TaikiFnit,项目名称:CMS-on-PHP-v2,代码行数:9,代码来源:appModel.php
示例7: moveTo
public function moveTo(MOXMAN_Vfs_IFile $dest)
{
if ($dest instanceof MOXMAN_Ftp_File) {
ftp_rename($this->fileSystem->getConnection(), $this->getInternalPath(), $dest->getInternalPath());
} else {
$this->copyTo($dest);
$this->delete(true);
}
}
开发者ID:newton27,项目名称:dolphin.pro,代码行数:9,代码来源:File.php
示例8: rename
/**
* Changes name of element
*
* @param string $newName New name
*
* @throws cFTP_Exception
*
* @return cFTP_Element
*/
public function rename($newName)
{
$success = @ftp_rename($this->handle, $this->name, $newName);
if( !$success )
throw new cFTP_Exception( "Could not rename", 36 );
return $this;
}
开发者ID:robik,项目名称:cFTP,代码行数:18,代码来源:Item.php
示例9: move_file
/**
* 方法:移动文件
* @path -- 原路径
* @newpath -- 新路径
* @type -- 若目标目录不存在则新建
*/
function move_file($path, $newpath, $type = true)
{
if ($type) {
$this->dir_mkdirs($newpath);
}
$this->off = @ftp_rename($this->conn_id, $path, $newpath);
if (!$this->off) {
echo "文件移动失败,请检查权限及原路径是否正确!";
}
}
开发者ID:8yong8,项目名称:vshop,代码行数:16,代码来源:Ftp.class.php
示例10: atnevez
function atnevez($id, $hova, $reginev)
{
if (isset($_POST["ujnev"])) {
$uj = $_POST["ujnev"];
ftp_rename($id, "{$hova}/{$reginev}", "{$hova}/{$uj}");
return header("Location: {$PHP_SELF}?mit=" . urlencode($hova));
} else {
print "<form action=\"{$PHP_SELF}?mit={$hova}&csa=" . urlencode($reginev) . "\" method=\"POST\">" . "<center>Új Név: <input type=\"text\" name=\"ujnev\" value=\"{$reginev}\"> " . "<input type=\"submit\" value=\"Átnevez\"></center>" . "</form><br>";
}
}
开发者ID:DeteCT0R,项目名称:gts-minicp,代码行数:10,代码来源:funkciok.php
示例11: rename
public function rename($remotePath, $localPath)
{
if (@ftp_nlist($this->link, $localPath)) {
if (!@ftp_rename($this->link, $localPath, $remotePath)) {
$error = error_get_last();
throw new Exception(sprintf('%s: Failed to %s file. Remote Path: %s, Local Path: %s, Error: %s', get_class($this), __FUNCTION__, $remotePath, $localPath, $error['message']));
}
}
return $this;
}
开发者ID:bramverstraten,项目名称:fogproject,代码行数:10,代码来源:FOGFTP.class.php
示例12: move_file
/**
* 方法:移动文件
* @path -- 原路径
* @newpath -- 新路径
* @type -- 若目标目录不存在则新建
*/
function move_file($path, $newpath, $type = true)
{
if ($type) {
$this->dir_mkdirs($newpath);
}
$this->off = @ftp_rename($this->conn_id, $path, $newpath);
if (!$this->off) {
return false;
} else {
return true;
}
}
开发者ID:codingoneapp,项目名称:codingone,代码行数:18,代码来源:ftp.php
示例13: moveFtpFile
public static function moveFtpFile($filename, $process)
{
$ftp_dir = $process . '/';
$final_destination = '/processed_feed/' . $filename;
$ftp_conn = ftp_connect(config('monster.ftp_server'), 21);
if ($ftp_conn) {
$ftp_login = ftp_login($ftp_conn, config('monster.ftp_user'), config('monster.ftp_password'));
if ($ftp_login) {
$is_passive = ftp_pasv($ftp_conn, true);
if ($is_passive) {
$is_dir_changed = ftp_chdir($ftp_conn, $ftp_dir);
if (!$is_dir_changed) {
ftp_close($ftp_conn);
} else {
// move ftp file
$ftp_files = ftp_nlist($ftp_conn, "");
if (in_array($filename, $ftp_files)) {
if ($process == 'test' || $process == 'processed_feed') {
// TO DO: keep it to test the export process
$is_deleted = ftp_delete($ftp_conn, '/' . $ftp_dir . $filename);
if ($is_deleted) {
ExportLog::create(['process' => $process, 'filename' => $filename, 'message' => 'was deleted from FTP [' . $process . '] folder']);
FileInProgress::where(['file_name' => $filename])->delete();
} else {
ExportLog::create(['process' => $process, 'filename' => $filename, 'message' => 'cannot be deleted']);
FileInProgress::where(['file_name' => $filename])->delete();
}
} else {
$is_moved = ftp_rename($ftp_conn, $filename, $final_destination);
if ($is_moved) {
ExportLog::create(['process' => $process, 'filename' => $filename, 'message' => 'was moved to FTP [processed_feed] folder']);
FileInProgress::where(['file_name' => $filename])->delete();
} else {
ExportLog::create(['process' => $process, 'filename' => $filename, 'message' => 'cannot be moved to [' . $final_destination . ']']);
}
}
} else {
ExportLog::create(['process' => $process, 'filename' => $filename, 'message' => 'is not found on the FTP server']);
}
}
}
}
ftp_close($ftp_conn);
}
//queue local file for deletion
FileDeleteQueue::create(['file_name' => $filename]);
}
开发者ID:lucy-udalykh,项目名称:samples,代码行数:47,代码来源:Monster.php
示例14: prepare
/**
* preprocess Index action.
*
* @access public
* @return string Forward name (null if no errors.)
*/
function prepare()
{
if ($this->af->validate() == 0) {
$username = $this->af->get('ftp_username');
$password = $this->af->get('ftp_password');
$xoops_root_path = $this->af->get('root_path');
var_dump($username, $password, $xoops_root_path);
if ($conn_id = ftp_connect('localhost')) {
$this->af->setApp($i++, $i++);
if (ftp_login($conn_id, $username, $password)) {
$ftp_root = $this->seekFTPRoot($conn_id);
if ($ftp_root !== false) {
$install_dir = str_replace($ftp_root, '', $xoops_root_path) . '/install';
$install_dir_dest = $install_dir . '_' . Ethna_Util::getRandom(16);
ftp_rename($conn_id, $install_dir, $install_dir_dest);
$mainfile = str_replace($ftp_root, '', $xoops_root_path) . '/mainfile.php';
ftp_chmod($conn_id, 0644, $mainfile);
return null;
}
}
}
}
return 'json_error';
}
开发者ID:hiro1173,项目名称:legacy,代码行数:30,代码来源:Removedir.php
示例15: rename
/**
* @inheritdoc
*/
public function rename($path, $newpath)
{
return ftp_rename($this->getConnection(), $path, $newpath);
}
开发者ID:stevedaddy,项目名称:react,代码行数:7,代码来源:Ftp.php
示例16: _move
/**
* Move file into another parent dir.
* Return new file path or false.
*
* @param string $source source file path
* @param string $target target dir path
* @param string $name file name
* @return string|bool
* @author Dmitry (dio) Levashov
**/
protected function _move($source, $targetDir, $name)
{
$target = $targetDir . DIRECTORY_SEPARATOR . $name;
return ftp_rename($this->connect, $source, $target) ? $target : false;
}
开发者ID:Jumpscale,项目名称:jumpscale_portal8,代码行数:15,代码来源:elFinderVolumeFTP.class.php
示例17: rename
/**
* Rename (or move) a file
*
* @access public
* @param string
* @param string
* @param bool
* @return bool
*/
function rename($old_file, $new_file, $move = FALSE)
{
if (!$this->_is_conn()) {
return FALSE;
}
$result = @ftp_rename($this->conn_id, $old_file, $new_file);
if ($result === FALSE) {
if ($this->debug == TRUE) {
$msg = $move == FALSE ? 'ftp_unable_to_rename' : 'ftp_unable_to_move';
$this->_error($msg);
}
return FALSE;
}
return TRUE;
}
开发者ID:dalinhuang,项目名称:palaestra,代码行数:24,代码来源:Ftp.php
示例18: rename
/**
* Method to rename a file/folder on the FTP server
*
* @access public
* @param string $from Path to change file/folder from
* @param string $to Path to change file/folder to
* @return boolean True if successful
*/
function rename($from, $to)
{
// If native FTP support is enabled lets use it...
if (FTP_NATIVE) {
if (@ftp_rename($this->_conn, $from, $to) === false) {
JError::raiseWarning('35', 'JFTP::rename: Bad response');
return false;
}
return true;
}
// Send rename from command to the server
if (!$this->_putCmd('RNFR ' . $from, 350)) {
JError::raiseWarning('35', 'JFTP::rename: Bad response', 'Server response: ' . $this->_response . ' [Expected: 320] From path sent: ' . $from);
return false;
}
// Send rename to command to the server
if (!$this->_putCmd('RNTO ' . $to, 250)) {
JError::raiseWarning('35', 'JFTP::rename: Bad response', 'Server response: ' . $this->_response . ' [Expected: 250] To path sent: ' . $to);
return false;
}
return true;
}
开发者ID:joebushi,项目名称:joomla,代码行数:30,代码来源:ftp.php
示例19: unserialize
$ftp_server_array = $nv_Request->get_string('ftp_server_array', 'session');
$ftp_server_array = unserialize($ftp_server_array);
}
if (isset($ftp_server_array['ftp_check_login']) and intval($ftp_server_array['ftp_check_login']) == 1) {
// Set up basic connection
$conn_id = ftp_connect($ftp_server_array['ftp_server'], $ftp_server_array['ftp_port'], 10);
// Login with username and password
$login_result = ftp_login($conn_id, $ftp_server_array['ftp_user_name'], $ftp_server_array['ftp_user_pass']);
if (!$conn_id || !$login_result) {
$ftp_check_login = 3;
} elseif (ftp_chdir($conn_id, $ftp_server_array['ftp_path'])) {
$ftp_check_login = 1;
}
}
if ($ftp_check_login == 1) {
ftp_rename($conn_id, NV_TEMP_DIR . '/' . NV_CONFIG_FILENAME, NV_CONFIG_FILENAME);
nv_chmod_dir($conn_id, NV_UPLOADS_DIR, true);
ftp_chmod($conn_id, 0644, NV_CONFIG_FILENAME);
ftp_close($conn_id);
} else {
@rename(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . NV_CONFIG_FILENAME, NV_ROOTDIR . '/' . NV_CONFIG_FILENAME);
}
}
if (file_exists(NV_ROOTDIR . '/' . NV_CONFIG_FILENAME)) {
$finish = 1;
} else {
$finish = 2;
}
$title = $lang_module['done'];
$contents = nv_step_7($finish);
}
开发者ID:NukeVietCMS,项目名称:CodeWeb,代码行数:31,代码来源:index.php
示例20: rename
public function rename($oldname, $newname)
{
$oldname = $this->get_absolute_path($oldname);
$newname = $this->get_absolute_path($newname);
if ($this->debug) {
echo "Renommage de {$oldname} en {$newname}\n<br>";
}
if (@ftp_rename($this->connexion, $oldname, $newname) === false) {
throw new Exception('Impossible de renommer le dossier ou le fichier');
}
unset($this->cached_dirs[$oldname]);
return $this;
}
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:13,代码来源:ftpclient.php
注:本文中的ftp_rename函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论