note 24374 deleted from function.ftp-rawlist by maxim

From: Date: Wed, 14 Aug 2002 17:09:48 +0000
Subject: note 24374 deleted from function.ftp-rawlist by maxim
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-35013@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... :-(

« previous php.notes (#35013) next »