本文整理汇总了PHP中PwUpload::initCurrUpload方法的典型用法代码示例。如果您正苦于以下问题:PHP PwUpload::initCurrUpload方法的具体用法?PHP PwUpload::initCurrUpload怎么用?PHP PwUpload::initCurrUpload使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PwUpload
的用法示例。
在下文中一共展示了PwUpload::initCurrUpload方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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';
}