note 89199 deleted from function.ftp-rmdir by thiago
| From: | thiago@php.net | Date: | Thu, 26 Feb 2009 12:21:52 +0000 |
| Subject: | note 89199 deleted from function.ftp-rmdir by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-151158@lists.php.net to get a copy of this message | ||
Note Submitter: szymon wilczyski
----
Function DeleteDirRecursive($resource, $path); works fine, however sometimes function stops at
ftp_nlist (just at the beginning) and after a while it returns false.
The reason is FTP active mode. To resolve it, use ftp_pasv:
<?php
// connect
$conn_id = ftp_connect($ftp_server);
// login
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// turn passive mode on
ftp_pasv($conn_id, true);
// now, list the current directory
$list = ftp_nlist($conn_id, '.');
var_dump($list);
// close connection
ftp_close($conn_id);
?>