note 87228 added to function.ftp-size
| From: | myquealer at gmail dot com | Date: | Tue, 25 Nov 2008 19:09:54 +0000 |
| Subject: | note 87228 added to function.ftp-size | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-146956@lists.php.net to get a copy of this message | ||
C_Muller, instead of getting the list of files in the parent directory and using in_array to see if
the directory exists, just do ftp_nlist on the directory you are checking the existence of. It will
return FALSE if the directory does not exist (or an array of files inside if it does).
if(ftp_nlist($ftp,$diretory)) {
#It exists
}
else{
#It does not exist (or some other error occurred)
}
or
if(! ftp_nlist($ftp,$diretory)) {
ftp_mkdir($ftp,$directory);
}
----
Server IP: 209.41.74.194
Probable Submitter: 75.148.93.109
----
Manual Page -- http://www.php.net/manual/en/function.ftp-size.php
Edit -- https://master.php.net/note/edit/87228
Del: integrated -- https://master.php.net/note/delete/87228/integrated
Del: useless -- https://master.php.net/note/delete/87228/useless
Del: bad code -- https://master.php.net/note/delete/87228/bad+code
Del: spam -- https://master.php.net/note/delete/87228/spam
Del: non-english -- https://master.php.net/note/delete/87228/non-english
Del: in docs -- https://master.php.net/note/delete/87228/in+docs
Del: other reasons-- https://master.php.net/note/delete/87228
Reject -- https://master.php.net/note/reject/87228
Search -- https://master.php.net/manage/user-notes.php