note 24374 added to function.ftp-rawlist

From: Date: Wed, 14 Aug 2002 15:56:31 +0000
Subject: note 24374 added to function.ftp-rawlist
Groups: php.notes 
Request: Send a blank email to php-notes+get-35003@lists.php.net to get a copy of this message
I discovered a strange bug with ftp_rawlist(). I don't know if it is os specific - I'm using Windows XP with PHP 4.2.2 and Apache 1.3.20 (PHP apache module). If i try to get a list for a dir name containing spaces, eg. 'my dir', it returnes an empty array: Dir structure: /my dir /otherdir Example script: <?php echo count(ftp_nlist($ftp, 'my dir')); // outputs 3 ('.', '..', 'otherdir') echo count(ftp_rawlist($ftp, 'my dir')); // output 0 ?> The solution is to first ftp_chdir() to the directory and then requesting the list for '.': <?php ftp_chdir($ftp, 'my dir'); echo count(ftp_rawlist($ftp, '.')); // outputs 3 ?> HTH - Took me hours to isolate this... :-( -- http://www.php.net/manual/en/function.ftp-rawlist.php http://master.php.net/manage/user-notes.php?action=edit+24374 http://master.php.net/manage/user-notes.php?action=delete+24374 http://master.php.net/manage/user-notes.php?action=reject+24374

« previous php.notes (#35003) next »