本文整理汇总了PHP中ftp_rename函数的典型用法代码示例。如果您正苦于以下问题:PHP ftp_rename函数的具体用法?PHP ftp_rename怎么用?PHP ftp_rename使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ftp_rename函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例3: rename
public function rename(string $oldName, string $newName) : bool
{
if (ftp_rename($this->connect, $oldName, $newName)) {
return true;
} else {
throw new FolderChangeNameException($oldName);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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 "文件移动失败,请检查权限及原路径是否正确!";
}
}
示例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>";
}
}
示例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;
}
示例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;
}
}
示例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]);
}
示例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';
}
示例15: rename
/**
* @inheritdoc
*/
public function rename($path, $newpath)
{
return ftp_rename($this->getConnection(), $path, $newpath);
}