326
326
* @param string $file
329
public function exists( $file ) {
330
$path = dirname( $file );
331
$filename = basename( $file );
329
public function exists($file) {
330
$list = @ftp_nlist($this->link, $file);
333
$file_list = @ftp_nlist( $this->link, '-a ' . $path );
335
$file_list = array_map( 'basename', $file_list );
332
if ( empty( $list ) && $this->is_dir( $file ) ) {
333
return true; // File is an empty directory.
338
return $file_list && in_array( $filename, $file_list );
336
return !empty($list); //empty list = no file, so invert.