当前位置: 首页>>代码示例>>PHP>>正文


PHP PwUpload::if_uploaded_file方法代码示例

本文整理汇总了PHP中PwUpload::if_uploaded_file方法的典型用法代码示例。如果您正苦于以下问题:PHP PwUpload::if_uploaded_file方法的具体用法?PHP PwUpload::if_uploaded_file怎么用?PHP PwUpload::if_uploaded_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PwUpload的用法示例。


在下文中一共展示了PwUpload::if_uploaded_file方法的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);
 }
开发者ID:jechiy,项目名称:PHPWind,代码行数:30,代码来源:upload.class.php

示例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);
 }
开发者ID:adi00,项目名称:wumaproject,代码行数:56,代码来源:upload.class.php

示例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';
 }
开发者ID:sherlockhouse,项目名称:aliyun,代码行数:37,代码来源:ver.customized.upload.php


注:本文中的PwUpload::if_uploaded_file方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。