Can someone please help? It is only polite.
I am using the following function to perform batch FTP.
function ftp_putAll($conn_id, $src_dir, $dst_dir) {
$d = dir($src_dir);
while($file = $d->read()) { // do this for each file in the directory
if ($file != "." && $file != "..") { // to prevent an infinite loop
if (is_dir($src_dir."/".$file)) { // do the following if it is a directory
if (!@ftp_chdir($conn_id, $dst_dir."/".$file)) {
ftp_mkdir($conn_id, $dst_dir."/".$file); // create directories that do not yet exist
}
ftp_putAll($conn_id, $src_dir."/".$file, $dst_dir."/".$file); // recursive part
} else {
$upload = ftp_put($conn_id, $dst_dir."/".$file, $src_dir."/".$file, FTP_BINARY); // put the files
}
}
}
$d->close();
}
But when I call the function, I keep getting the error:
Warning: dir(/www/cms_creator/trial/design_01/) [function.dir]: failed to open dir: Invalid argument in c:\Inetpub\wwwroot\tests\PHP\test8.php on line 4
Fatal error: Call to a member function read() on a non-object in c:\Inetpub\wwwroot\tests\PHP\test8.php on line 5
The first one might need the full path, but the second one is where I need help.
|