本文整理汇总了PHP中PwUpload::postupload方法的典型用法代码示例。如果您正苦于以下问题:PHP PwUpload::postupload方法的具体用法?PHP PwUpload::postupload怎么用?PHP PwUpload::postupload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PwUpload
的用法示例。
在下文中一共展示了PwUpload::postupload方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload
function upload(&$bhv)
{
$uploaddb = array();
foreach ($_FILES as $key => $value) {
if (!PwUpload::if_uploaded_file($value['tmp_name']) || !$bhv->allowType($key)) {
continue;
}
$atc_attachment = $value['tmp_name'];
$upload = PwUpload::initCurrUpload($key, $value);
if (empty($upload['ext']) || !isset($bhv->ftype[$upload['ext']])) {
showUploadMsg('upload_type_error');
}
if ($upload['size'] < 1 || $upload['size'] > $bhv->ftype[$upload['ext']] * 1024) {
$GLOBALS['atc_attachment_name'] = $upload['name'];
$GLOBALS['oversize'] = $bhv->ftype[$upload['ext']];
showUploadMsg($upload['size'] < 1 ? 'upload_size_0' : 'upload_size_error');
}
list($filename, $savedir) = $bhv->getFilePath($upload);
$source = PwUpload::savePath($bhv->ifftp, $filename, $savedir);
if (!PwUpload::postupload($atc_attachment, $source)) {
showUploadMsg('upload_error');
}
clearstatcache();
$upload['size'] = ceil(filesize($source) / 1024);
$upload['fileuploadurl'] = $savedir . $filename;
PwUpload::operateAttach($source, $filename, $savedir, $upload, $bhv);
$uploaddb[] = $upload;
}
return $bhv->update($uploaddb);
}
示例2: upload
function upload(&$bhv)
{
$uploaddb = array();
foreach ($_FILES as $key => $value) {
if (!PwUpload::if_uploaded_file($value['tmp_name']) || !$bhv->allowType($key)) {
continue;
}
$atc_attachment = $value['tmp_name'];
$upload = PwUpload::initCurrUpload($key, $value);
if (empty($upload['ext']) || !isset($bhv->ftype[$upload['ext']])) {
uploadmsg('upload_type_error');
}
if ($upload['size'] < 1 || $upload['size'] > $bhv->ftype[$upload['ext']] * 1024) {
$GLOBALS['atc_attachment_name'] = $upload['name'];
$GLOBALS['oversize'] = $bhv->ftype[$upload['ext']];
uploadmsg($upload['size'] < 1 ? 'upload_size_0' : 'upload_size_error');
}
list($filename, $savedir, $thumbname, $thumbdir) = $bhv->getFilePath($upload);
$upload['fileuploadurl'] = $savedir . $filename;
$source = PwUpload::savePath($bhv->ifftp, $filename, $savedir);
$thumburl = PwUpload::savePath($bhv->ifftp, $thumbname, $thumbdir, 'thumb_');
if (!PwUpload::postupload($atc_attachment, $source)) {
uploadmsg('upload_error');
}
$upload['size'] = ceil(filesize($source) / 1024);
if (in_array($upload['ext'], array('gif', 'jpg', 'jpeg', 'png', 'bmp', 'swf'))) {
require_once R_P . 'require/imgfunc.php';
if (!($img_size = GetImgSize($source, $upload['ext']))) {
P_unlink($source);
uploadmsg('upload_content_error');
}
if ($upload['ext'] != 'swf') {
if ($bhv->allowThumb()) {
$thumbsize = PwUpload::makeThumb($source, $thumburl, $bhv->getThumbSize(), $upload['ifthumb']);
}
if ($bhv->allowWaterMark()) {
PwUpload::waterMark($source, $upload['ext'], $img_size);
$upload['ifthumb'] && PwUpload::waterMark($thumburl, $upload['ext']);
}
$upload['type'] = 'img';
}
} elseif ($upload['ext'] == 'txt') {
if (preg_match('/(onload|submit|post|form)/i', readover($source))) {
P_unlink($source);
uploadmsg('upload_content_error');
}
$upload['type'] = 'txt';
}
if ($bhv->ifftp) {
PwUpload::movetoftp($source, $upload['fileuploadurl']);
$upload['ifthumb'] && PwUpload::movetoftp($thumburl, $thumbdir . $thumbname);
}
$uploaddb[] = $upload;
}
$bhv->update($uploaddb);
}
示例3: upload
function upload(&$bhv)
{
$uploaddb = array();
$count = $size = 0;
foreach ($_FILES as $key => $value) {
if (!PwUpload::if_uploaded_file($value['tmp_name']) || !$bhv->allowType($key)) {
continue;
}
$atc_attachment = $value['tmp_name'];
$upload = PwUpload::initCurrUpload($key, $value);
if (empty($upload['ext']) || !isset($bhv->ftype[$upload['ext']])) {
$errCode = '上传附件类型错误!';
return $errCode;
}
if ($upload['size'] < 1 || $upload['size'] > $bhv->ftype[$upload['ext']] * 1024) {
$GLOBALS['atc_attachment_name'] = $upload['name'];
$GLOBALS['oversize'] = $bhv->ftype[$upload['ext']];
$errCode = '上传附件太小或超出' . $bhv->ftype[$upload['ext']] . 'KB!';
return $errCode;
}
list($filename, $savedir) = $bhv->getFilePath($upload);
$source = PwUpload::savePath($bhv->ifftp, $filename, $savedir);
if (!PwUpload::postupload($atc_attachment, $source)) {
$errCode = '上传附件出错';
return $errCode;
}
clearstatcache();
$upload['size'] = ceil(filesize($source) / 1024);
$upload['fileuploadurl'] = $savedir . $filename;
PwUpload::operateAttach($source, $filename, $savedir, $upload, $bhv);
$count++;
$size += $upload['size'] * 1024;
$uploaddb[] = $upload;
}
$bhv->update($uploaddb);
return 'success';
}
示例4: elseif
$savedir = "Type_{$attach_ext}";
} elseif ($o_attachdir == 2) {
$savedir = 'Mon_' . date('ym');
} elseif ($o_attachdir == 3) {
$savedir = 'Day_' . date('ymd');
}
}
foreach ($diaryAttachs as $at) {
if ($at['type'] == 'img') {
$a_url = geturl($at['attachurl'], 'show');
$attach_ext = strtolower(substr(strrchr($a_url[0], '.'), 1));
$prename = substr(md5($timestamp . randstr(8)), 10, 15);
$filename = $winduid . "_{$did}_{$prename}.{$attach_ext}";
$attachurl = "{$savedir}/{$filename}";
$fileuplodeurl = "{$attachdir}/diary/{$attachurl}";
$uploadSerivce->postupload($a_url[0], $fileuplodeurl);
if ($db_ifathumb) {
$thumbdir = "thumb/diary/{$attachurl}";
$thumburl = "{$attachdir}/{$thumbdir}";
$ifthumb = 1;
$thumbsize = $uploadSerivce->MakeThumb($fileuplodeurl, $thumburl, $db_athumbsize, $ifthumb);
}
$data = array('did' => $did, 'uid' => $winduid, 'hits' => 0, 'name' => $at['name'], 'type' => $at['type'], 'size' => $at['size'], 'attachurl' => 'diary/' . $attachurl, 'needrvrc' => $at['needrvrc'], 'special' => $at['special'], 'ctype' => $at['ctype'], 'uploadtime' => $timestamp, 'descrip' => $at['descrip'], 'ifthumb' => 0);
$db->update("INSERT INTO pw_attachs SET " . S::sqlSingle($data));
$aid = $db->insert_id();
$data['aid'] = $aid;
$aids[] = $data['aid'];
$diaryAid[$aid] = $data;
}
}
//*=======拷贝图片===========*//