Ejemplo n.º 1
0
//
// 7. moves files on the FTP server
//
foreach ($files as $file) {
    $ret = $f->put($file, basename($file), $overwrite);
    if (PEAR::isError($ret)) {
        if ($ret->getCode() == NET_FTP_ERR_OVERWRITEREMOTEFILE_FORBIDDEN and !$overwrite) {
            printf('%s <br />', $ret->getMessage());
            continue;
            // it is just a warning when \$overwrite variable is set to false
        }
        die($ret->getMessage());
    }
    printf('<b>%s</b> transfer completed <br />', basename($file));
}
$f->detach($observer);
//
// 8. checks if files are really on the FTP server
//
$ret = $f->ls(null, NET_FTP_RAWLIST);
if (PEAR::isError($ret)) {
    $f->disconnect();
    die($ret->getMessage());
}
print '<pre>';
var_dump($ret);
print '</pre>';
//
// 9. says goodbye to the FTP server !
//
$f->disconnect();