本文整理汇总了PHP中PwUpload::getFtpObj方法的典型用法代码示例。如果您正苦于以下问题:PHP PwUpload::getFtpObj方法的具体用法?PHP PwUpload::getFtpObj怎么用?PHP PwUpload::getFtpObj使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PwUpload
的用法示例。
在下文中一共展示了PwUpload::getFtpObj方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
function add($attach)
{
$upload = array('attname' => 'attachment', 'id' => intval($attach['aid']), 'name' => $attach['name'], 'size' => $attach['size'], 'type' => 'zip', 'ifthumb' => 0, 'fileuploadurl' => '');
$upload['ext'] = strtolower(substr(strrchr($attach['attachurl'], '.'), 1));
if (empty($upload['ext']) || !isset($this->bhv->ftype[$upload['ext']])) {
return false;
}
if ($upload['size'] < 1 || $upload['size'] > $this->bhv->ftype[$upload['ext']] * 1024) {
return false;
}
$dir = dirname($attach['attachurl']);
$dir && ($dir .= '/');
$srcfile = PwUpload::savePath($this->bhv->ifftp, basename($attach['attachurl']), $dir);
if (!file_exists($srcfile)) {
if ($this->bhv->ifftp) {
$ftp =& PwUpload::getFtpObj();
PwUpload::createFolder(dirname($srcfile));
if (!$ftp->get($srcfile, $attach['attachurl'])) {
return false;
}
} else {
return false;
}
}
list($filename, $savedir) = $this->bhv->getFilePath($upload);
$source = PwUpload::savePath($this->bhv->ifftp, $filename, $savedir);
PwUpload::createFolder(dirname($source));
if (!copy($srcfile, $source)) {
return false;
}
$upload['fileuploadurl'] = $savedir . $filename;
PwUpload::operateAttach($source, $filename, $savedir, $upload, $this->bhv);
$this->upload[] = $upload;
return true;
}
示例2: movetoftp
/**
* @static
*/
function movetoftp($srcfile, $dstfile)
{
$ftp =& PwUpload::getFtpObj();
if ($ftp->upload($srcfile, $dstfile)) {
P_unlink($srcfile);
return true;
}
return false;
}