note 87256 modified in function.ftp-chdir by danbrown
| From: | danbrown@php.net | Date: | Wed, 26 Nov 2008 21:16:33 +0000 |
| Subject: | note 87256 modified in function.ftp-chdir by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-147004@lists.php.net to get a copy of this message | ||
Works like the other functions in this page's notes, but this one doesn't make use of a
global FTP connection, so it takes parameters like the other functions in the extension
<?php
function ftp_directory_exists($ftp, $dir)
{
// Get the current working directory
$origin = ftp_pwd($ftp);
// Attempt to change directory, suppress errors
if (@ftp_chdir($ftp, $dir))
{
// If the directory exists, set back to origin
ftp_chdir($ftp, $origin);
return true;
}
// Directory does not exist
return false;
}
?>
--was--
Works like the other functions in this page's notes, but this one doesn't make use of a
global FTP connection, so it takes parameters like the other functions in the extension
function ftp_directory_exists($ftp, $dir)
{
// Get the current working directory
$origin = ftp_pwd($ftp);
// Attempt to change directory, suppress errors
if (@ftp_chdir($ftp, $dir))
{
// If the directory exists, set back to origin
ftp_chdir($ftp, $origin);
return true;
}
// Directory does not exist
return false;
}
http://php.net/manual/en/function.ftp-chdir.php