Exemplo n.º 1
0
function uploadftp($picpath, $picfile)
{
    $Newpicpath = replaceStr($picpath, "../../", "");
    $Newpicpath = replaceStr($Newpicpath, "../", "");
    $ftp = new AppFtp(app_ftphost, app_ftpuser, app_ftppass, app_ftpport, app_ftpdir);
    if ($ftp->ftpStatus == 1) {
        $localfile = root . $Newpicpath . $picfile;
        $remotefile = app_ftpdir . $Newpicpath . $picfile;
        $ftp->mkdirs(app_ftpdir . $Newpicpath);
        $ftpput = $ftp->put($localfile, $remotefile);
        if (!$ftpput) {
            echo "上传图片到FTP远程服务器失败!";
            exit;
        }
        $ftp->bye();
        if (app_ftpdel == 1) {
            unlink($picpath . $picfile);
        }
    } else {
        echo $ftp->ftpStatusDes;
        exit;
    }
}
Exemplo n.º 2
0
function uploadftp($picpath, $picfile)
{
    $ftp = new AppFtp($GLOBALS['MAC']['upload']['ftphost'], $GLOBALS['MAC']['upload']['ftpuser'], $GLOBALS['MAC']['upload']['ftppass'], $GLOBALS['MAC']['upload']['ftpport'], $GLOBALS['MAC']['upload']['ftpdir']);
    if ($ftp->ftpStatus == 1) {
        $localfile = MAC_ROOT . '/' . $picpath . $picfile;
        $remotefile = $MAC['upload']['ftpdir'] . $picpath . $picfile;
        $ftp->mkdirs($MAC['upload']['ftpdir'] . $picpath);
        $ftpput = $ftp->put($localfile, $remotefile);
        if (!$ftpput) {
            echo '上传图片到FTP远程服务器失败!';
        } else {
            $ftp->bye();
            if ($GLOBALS['MAC']['upload']['ftpdel'] == 1) {
                unlink(MAC_ROOT . '/' . $picpath . $picfile);
            }
        }
    } else {
        echo $ftp->ftpStatusDes;
        exit;
    }
    unset($ftp);
}