Re: new FTP function
| From: | Marco Pivetta | Date: | Fri, 18 Jan 2013 15:37:36 +0000 |
| Subject: | Re: new FTP function | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-65031@lists.php.net to get a copy of this message | ||
Heya KISE,
I just checked a bit around and found that current implementations actually
simply deal with the warning:
https://github.com/rjkip/ftp-php/blob/master/src/FtpPhp/FtpClient.php#L172-L186
https://github.com/rjkip/ftp-php/blob/master/src/FtpPhp/FtpClient.php#L92-L116
What kind of problems is the warning currently causing in your code?
Marco Pivetta
http://twitter.com/Ocramius
http://ocramius.github.com/
On 18 January 2013 16:33, KISE <wowkise@gmail.com> wrote:
> Paul Dragoonis,
>
> Actually it wont work i did tried it before, if the dir end with / it will
> list the directories inside the path you gave it and if it doesn't have any
> directories it will return false since there is no directories to return.
>
> you have to take out the last / and then remove the directory in question
> and list the files in the parent directory and check if the dir exists
> otherwise it will return false, i spent 3hrs yesterday thinking why its
> returning false even though the directory exists.
>
> On Fri, Jan 18, 2013 at 6:28 PM, Paul Dragoonis <dragoonis@gmail.com>
> wrote:
>
> >
> > On Fri, Jan 18, 2013 at 3:18 PM, KISE <wowkise@gmail.com> wrote:
> >
> >> $res = ftp_nlist($this->conn_id, '-dF '. $dir);
> >>
> >
> > This could be done in two lines.
> >
> > function dir_exists($conn, $dir) {
> > $list = ftp_nlist($conn, '-dF '. $dir);
> > return in_array($dir, $list);
> > }
> >
>