Re: new FTP function
| From: | KISE | Date: | Fri, 18 Jan 2013 15:44:44 +0000 |
| Subject: | Re: new FTP function | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-65032@lists.php.net to get a copy of this message | ||
hello Marco Pivetta,
while the implementations you linked indeed works, it also kinda big and
involve changing the error handler just so that it doesn't show the error,
which i think is not the way to do it. i think there should be simple way
to check like "is_dir" or "is_file".
anyway thanks for the hints, i have sent request to bugs.php.net, and i
dont like to spam the dev list since they quite busy already
PS: and sorry for the grammar errors, English is not my native tongue.
On Fri, Jan 18, 2013 at 6:37 PM, Marco Pivetta <ocramius@gmail.com> wrote:
> 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-L116nQ§JÙæón¸‚Œû8
> ž{
>
> 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);
>> > }
>> >
>>
>
>