Re: ftp_chdir notice error
| From: | Jigar Dhulla | Date: | Sun, 16 Feb 2014 06:10:28 +0000 |
| Subject: | Re: ftp_chdir notice error | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-322893@lists.php.net to get a copy of this message | ||
Okay. According to ftp_chdr(); that is an error. So i don't think you can
avoid that.
Other option is that you can use FTP Wrapper (
http://www.php.net/manual/en/wrappers.ftp.php
) is_dir();
like:
is_dir('ftp://user:password@example.com/some/dir/path');
On Sun, Feb 16, 2014 at 11:31 AM, Ron Piggott <
ron.piggott@actsministries.org> wrote:
> I know about using "@" to suppress errors.
>
> I want to know if it is possible to avoid causing the error altogether.
>
> Ron Piggott
>
>
>
> <http://www.TheVerseOfTheDay.info>www.TheVerseOfTheDay.info<http://www.theverseoftheday.info>
>
> *From:* Jigar Dhulla <jigar.tidus@gmail.com>
> *Sent:* Sunday, February 16, 2014 12:58 AM
> *To:* Ron Piggott <ron.piggott@actsministries.org>
> *Cc:* php-general@lists.php.net
> *Subject:* Re: [PHP] 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@actsministries.org> 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
>
--
Regards,
Jigar Dhulla