Re: ftp_chdir notice error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There is no equivalent to file_exists in the FTP function set, so you'll need to implement it yourself by listing the directory and checking for it yourself.


-Stuart



—
Sent from my leaf blower

On Sun, Feb 16, 2014 at 6:01 AM, Ron Piggott
<ron.piggott@xxxxxxxxxxxxxxxxxx> wrote:

> I know about using “@” to suppress errors.  
> I want to know if it is possible to avoid causing the error altogether.
> Ron Piggott
> www.TheVerseOfTheDay.info 
> From: Jigar Dhulla 
> Sent: Sunday, February 16, 2014 12:58 AM
> To: Ron Piggott 
> Cc: php-general@xxxxxxxxxxxxx 
> Subject: Re:  ftp_chdir notice error
> "@" in the beginning of the function like @ftp_chdir(); should suppress the warning. Or you can use error_reporting(); 
> error_reporting(E_ERROR | E_PARSE); should suppress the warning too.
> On Sun, Feb 16, 2014 at 1:16 AM, Ron Piggott <ron.piggott@xxxxxxxxxxxxxxxxxx> wrote:
>   I am using the result of “ ftp_chdir “ to know if the directory exists or not.  If the result is “false” then I make the directory:
>   ===
>   <?php
>   if ( ftp_chdir( $this->getFtpConnection() , $new_directory ) == FALSE ) {
>       if ( ftp_mkdir( $this->getFtpConnection() , $new_directory ) ) {
>           return TRUE;
>       } else {
>           return FALSE;
>       }
>   } else {
>       return TRUE;
>   }
>   ?>
>   ===
>   However when the result is ‘false’ a PHP warning is created:  “ PHP Warning:  ftp_chdir(): Failed to change directory “  How can I avoid this warning?
>   Ron
>   Ron Piggott
>   www.TheVerseOfTheDay.info
> -- 
> Regards, 
> Jigar Dhulla

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux