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


PHP PwUpload类代码示例

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


在下文中一共展示了PwUpload类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addAction

 public function addAction()
 {
     $status = $this->getInput('startup_status');
     //
     $config = new PwConfigSet('native');
     if (count($_FILES)) {
         Wind::import('SRV:upload.action.PwStartUpUpload');
         Wind::import('LIB:upload.PwUpload');
         $bhv = new PwStartUpUpload();
         $bhv->filename = 'startup';
         //
         $upload = new PwUpload($bhv);
         if ($upload->check() === true) {
             $result = $upload->execute();
         }
         if ($result !== true) {
             $this->showError($result->getError());
         }
         if (!($data = $bhv->getAttachInfo())) {
             $this->showError('upload.fail');
         }
         //
         $filepath = $upload->getStore()->getAbsolutePath($data['filename'], $data['path']);
         $filecontent = file_get_contents($filepath);
         //
         $config->set('startup.imgmd5', md5($filecontent));
         $config->set('startup.img', $data['path'] . $data['filename']);
     }
     $config->set('startup.status', $status)->flush();
     $this->showMessage('ADMIN:success');
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:31,代码来源:StartUpController.php

示例2: dotaoAction

 /**
  * 淘宝推广图片 
  * 
  * @access public
  * @return void
  */
 public function dotaoAction()
 {
     if (!($user = $this->_getUser())) {
         $this->showError('login.not');
     }
     $fid = $this->getInput('fid', 'post');
     //
     $this->_accpetUploadForH5();
     //
     Wind::import('SRV:upload.action.PwTaoUpload');
     Wind::import('LIB:upload.PwUpload');
     $bhv = new PwTaoUpload();
     $bhv->filename = date('YmdHis');
     //
     $upload = new PwUpload($bhv);
     if (($result = $upload->check()) === true) {
         $result = $upload->execute();
     }
     if ($result !== true) {
         $this->showError($result->getError());
     }
     if (!($data = $bhv->getAttachInfo())) {
         $this->showError('upload.fail');
     }
     $data['path'] = Pw::getPath($data['path'] . $data['filename']);
     //
     $this->setOutput($data, 'data');
     $this->showMessage('upload.success');
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:35,代码来源:UploadController.php

示例3: doAddAction

 /**
  * 发存修改一个发现数据 
  * 
  * @access public
  * @return void
  */
 public function doAddAction()
 {
     list($fid, $title, $href, $des, $vieworder) = $this->getInput(array('fid', 'title', 'href', 'des', 'vieworder'));
     $title = trim($title);
     $href = trim($href);
     $des = trim($des);
     $vieworder = (int) $vieworder;
     if (empty($title)) {
         $this->showError("NATIVE:fresh.title.empty");
     }
     if (empty($href)) {
         $this->showError("NATIVE:fresh.link.empty");
     }
     if (Pw::strlen($title) > 5) {
         $this->showError("名称不能超过5个字符");
     }
     if (Pw::strlen($des) > 9) {
         $this->showError("备注不能超过9个字符");
     }
     if ($fid) {
         $fname = $fid;
     } else {
         $maxId = $this->_getDao()->getMaxId();
         $fname = count($maxId) ? $maxId['fresh_id'] + 1 : 1;
     }
     if (!$fid && !$_FILES) {
         $this->showError('NATIVE:upload.empty');
     }
     if ($_FILES) {
         Wind::import('SRV:upload.action.PwFreshUpload');
         Wind::import('LIB:upload.PwUpload');
         $bhv = new PwFreshUpload();
         $bhv->filename = $fname;
         $upload = new PwUpload($bhv);
         if ($upload->check() === true) {
             $result = $upload->execute();
         }
         if ($result !== true) {
             $this->showError($result->getError());
         }
         if (!($data = $bhv->getAttachInfo())) {
             $this->showError('upload.fail');
         }
         $img = $data['path'] . $data['filename'];
     }
     $data = array('title' => $title, 'href' => $href, 'des' => $des, 'vieworder' => $order);
     if ($img && $_FILES) {
         $data['img'] = $img;
     }
     if ($fid) {
         $this->_getDao()->updateFresh($fid, $data);
     } else {
         $this->_getDao()->addFresh($data);
     }
     $this->showMessage('success');
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:62,代码来源:FreshController.php

示例4: dosetAction

 /**
  *
  * @access public
  * @return
  * @example
  *
  */
 public function dosetAction()
 {
     /*
     $vd = function() {
         foreach(func_get_args() as $arg) {
             error_log(var_export($arg, true));
         }
     };
     */
     $config = new PwConfigSet('notifier');
     /*
      * 如果form的class是J_ajaxForm,可以只按照count($_FILES)来判断;
      * 如果不是,需要判断具体的tmp_name是否为空来判断是否选择了文件。
      *
      */
     if (count($_FILES) && !empty($_FILES['avatar']['tmp_name'])) {
         Wind::import('SRV:upload.action.PwStartUpUpload');
         Wind::import('LIB:upload.PwUpload');
         $bhv = new PwStartUpUpload();
         $bhv->filename = 'avatar';
         $upload = new PwUpload($bhv);
         if ($upload->check() === true) {
             $result = $upload->execute();
         }
         if ($result !== true) {
             $this->showError($result->getError());
         }
         if (!($data = $bhv->getAttachInfo())) {
             $this->showError('upload.fail');
         }
         // 添加进设置项
         $config->set('avatar', $data['path'] . $data['filename']);
     }
     $nickname = $this->getInput('nickname');
     if (empty($nickname)) {
         $nickname = PwLaiWangSerivce::$defaultNotifier['nickname'];
     }
     $usertype = intval($this->getInput('usertype'));
     if ($usertype != PwLaiWangSerivce::USERTYPE_NAME && $usertype != PwLaiWangSerivce::USERTYPE_ID) {
         $usertype = PwLaiWangSerivce::USERTYPE_NAME;
     }
     $user = $this->getInput('user');
     if ($usertype == PwLaiWangSerivce::USERTYPE_NAME) {
         $userinfo = Wekit::load('user.PwUser')->getUserByName($user, PwUser::FETCH_MAIN);
     } else {
         $userinfo = Wekit::load('user.PwUser')->getUserByUid($user, PwUser::FETCH_MAIN);
     }
     if (empty($userinfo)) {
         $this->showError('NATIVE:user.notfound');
     }
     $config->set('nickname', $nickname)->set('usertype', $usertype)->set('username', $userinfo['username'])->set('userid', $userinfo['uid'])->flush();
     $this->showMessage('ADMIN:success', 'native/notifier/run/', true);
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:60,代码来源:NotifierController.php

示例5: doAddAction

 public function doAddAction()
 {
     list($bid, $title, $clickType, $href, $vieworder, $img) = $this->getInput(array('bid', 'title', 'clickType', 'href', 'vieworder', 'img'));
     $title = trim($title);
     $href = trim($href);
     $vieworder = (int) $vieworder;
     if (count($this->_getDao()->getBanner(PwBanner::BANNER_TYPE_NATIVE_INDEX)) >= 4 && !$bid) {
         $this->showError("NATIVE:banner.num.out");
     }
     if (empty($title)) {
         $this->showError("NATIVE:banner.title.empty");
     }
     if (empty($clickType)) {
         $this->showError("NATIVE:banner.clickType.empty");
     }
     if (empty($href)) {
         $this->showError("NATIVE:banner.link.empty");
     }
     if ($bid) {
         $fname = $bid;
     } else {
         $maxId = $this->_getDao()->getMaxId();
         $fname = count($maxId) ? $maxId['banner_id'] + 1 : 1;
     }
     if (count($_FILES)) {
         Wind::import('SRV:upload.action.PwBannerUpload');
         Wind::import('LIB:upload.PwUpload');
         $bhv = new PwBannerUpload();
         $bhv->filename = $fname;
         $upload = new PwUpload($bhv);
         if ($upload->check() === true) {
             $result = $upload->execute();
         }
         if ($result !== true) {
             $this->showError($result->getError());
         }
         if (!($data = $bhv->getAttachInfo())) {
             $this->showError('upload.fail');
         }
         $img = $data['path'] . $data['filename'];
     } elseif (empty($bid)) {
         $this->showError('upload.empty');
     }
     $data = array('banner_type' => PwBanner::BANNER_TYPE_NATIVE_INDEX, 'type' => $clickType, 'title' => $title, 'href' => $href, 'img' => $img, 'vieworder' => $order);
     if ($bid) {
         $this->_getDao()->updateBanner($bid, $data);
     } else {
         $this->_getDao()->addBanner($data);
     }
     $this->showMessage('success');
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:51,代码来源:BannerController.php

示例6: 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;
 }
开发者ID:sherlockhouse,项目名称:aliyun,代码行数:35,代码来源:saveattach.class.php

示例7: _uploadCsv

 /**
  * 上传csv文件到服务器端
  *
  */
 function _uploadCsv()
 {
     L::loadClass('csvupload', 'upload', false);
     $csvupload = new CsvUpload($this->_uid);
     PwUpload::upload($csvupload);
     $this->_filename = $csvupload->pathname;
 }
开发者ID:jechiy,项目名称:PHPWind,代码行数:11,代码来源:csv.inv.php

示例8: replaceAction

 /**
  * 暂时不用
  */
 public function replaceAction()
 {
     $aid = $this->getInput('aid');
     Wind::import('SRV:upload.action.PwAttReplaceUpload');
     Wind::import('LIB:upload.PwUpload');
     $bhv = new PwAttReplaceUpload($this->loginUser, $aid);
     $upload = new PwUpload($bhv);
     if (($result = $upload->check()) === true) {
         $result = $upload->execute();
     }
     if ($result !== true) {
         $this->showError($result->getError());
     }
     $this->setOutput($bhv->getAttachInfo(), 'data');
     $this->showMessage('upload.success');
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:19,代码来源:UploadController.php

示例9: _uploadFile

 private function _uploadFile()
 {
     Wind::import('SRV:upload.action.PwDesignImageUpload');
     Wind::import('SRV:upload.PwUpload');
     $bhv = new PwDesignImageUpload();
     $upload = new PwUpload($bhv);
     if (($result = $upload->check()) === true) {
         $result = $upload->execute();
     }
     if ($result !== true) {
         return $result;
     }
     $image = $bhv->getAttachInfo();
     if (!$image['filename']) {
         return '';
     }
     return Pw::getPath($image['path'] . $image['filename']);
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:18,代码来源:PwDesignImageDataService.php

示例10: updateIcon

 public function updateIcon($uid)
 {
     $userBo = Wekit::getLoginUser();
     if ($userBo->uid != $uid) {
         return $this->buildResponse(USER_NOT_LOGIN, "用户未登录");
     }
     Wind::import('SRV:upload.action.PwAvatarUpload');
     Wind::import('LIB:upload.PwUpload');
     $bhv = new PwAvatarUpload($userBo);
     $upload = new PwUpload($bhv);
     if (($result = $upload->check()) === true) {
         $result = $upload->execute();
     }
     if ($result !== true) {
         return $this->buildResponse(USER_UPDATE_ERROR, "更新头像");
     } else {
         return $this->buildResponse(0, '更新成功');
     }
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:19,代码来源:ACloudVerCustomizedUser.php

示例11: makeThumb

 public function makeThumb(PwImage $image, $thumbInfo, $store)
 {
     $quality = Wekit::C('attachment', 'thumb.quality');
     foreach ($thumbInfo as $key => $value) {
         $thumburl = $store->getAbsolutePath($value[0], $value[1]);
         PwUpload::createFolder(dirname($thumburl));
         $result = $image->makeThumb($thumburl, $value[2], $value[3], $quality, $value[4], $value[5]);
         if ($result === true && $image->filename != $thumburl) {
             $this->ifthumb |= 1 << $key;
             $this->_thumb[] = array($thumburl, $value[1] . $value[0]);
         }
     }
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:13,代码来源:AcloudVerCommonUtility.php

示例12: check

 /**
  * @see PwUploadAction.check
  */
 public function check()
 {
     if (!$this->user->isExists()) {
         return new PwError('login.not');
     }
     if (!$this->forum->isForum()) {
         return new PwError('FORUM_IS_NOT_EXISTS');
     }
     if (($result = $this->forum->allowUpload($this->user)) !== true) {
         return new PwError('BBS:forum.permissions.upload.allow', array('{grouptitle}' => $this->user->getGroupInfo('name')));
     }
     if (!$this->forum->foruminfo['allow_upload'] && !$this->user->getPermission('allow_upload')) {
         return new PwError('permission.upload.allow', array('{grouptitle}' => $this->user->getGroupInfo('name')));
     }
     if ($uploadPerday = $this->user->getPermission('uploads_perday')) {
         $count = PwUpload::countUploadedFile() + count($this->flashatt);
         $todayupload = $this->user->info['lastpost'] < Pw::getTdtime() ? 0 : $this->user->info['todayupload'];
         if ($count > 0 && $count + $todayupload > $uploadPerday) {
             return new PwError('permission.upload.nums.perday', array('{nums}' => $uploadPerday));
         }
     }
     return true;
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:26,代码来源:PwAttUpload.php

示例13: pwSqlSingle

     } else {
         $db->update("INSERT INTO pw_cnalbum SET " . pwSqlSingle(array('aname' => getLangInfo('app', 'defaultalbum'), 'atype' => 0, 'ownerid' => $winduid, 'owner' => $windid, 'lasttime' => $timestamp, 'crtime' => $timestamp)));
         $aid = $db->insert_id();
     }
 }
 !$aid && Showmsg('colony_albumclass');
 $rt = $db->get_one("SELECT aname,photonum,ownerid,private,lastphoto FROM pw_cnalbum WHERE atype='0' AND aid=" . pwEscape($aid));
 if (empty($rt)) {
     Showmsg('undefined_action');
 } elseif ($winduid != $rt['ownerid']) {
     Showmsg('colony_phototype');
 }
 $o_maxphotonum && $rt['photonum'] >= $o_maxphotonum && Showmsg('colony_photofull');
 require_once R_P . 'lib/upload/photoupload.class.php';
 $img = new PhotoUpload($aid);
 PwUpload::upload($img);
 pwFtpClose($ftp);
 if (!($photos = $img->getAttachs())) {
     refreshto("{$basename}a=upload", 'colony_uploadnull');
 }
 $photoNum = count($photos);
 $pid = $img->getNewID();
 $lastpid = getLastPid($aid, 4);
 array_unshift($lastpid, $pid);
 if (!$rt['private']) {
     $feedText = "[url={$db_bbsurl}/{$basename}space=1&a=album&aid={$aid}&u={$winduid}]{$rt[aname]}[/url]\n";
     foreach ($photos as $value) {
         $feedText .= "[url={$db_bbsurl}/{#APPS_BASEURL#}q=photos&space=1&a=view&pid={$pid}&u={$winduid}][img]" . getphotourl($value['path'], $value['ifthumb']) . "[/img][/url]&nbsp;";
     }
     pwAddFeed($winduid, 'photo', $pid, array('num' => $photoNum, 'text' => $feedText));
     //会员资讯缓存
开发者ID:adi00,项目名称:wumaproject,代码行数:31,代码来源:index.php

示例14: intval

 }
 if ($config['width']) {
     $config['width'] = intval($config['width']) . ($config['width'][strlen($config['width']) - 1] == '%' ? '%' : '');
 }
 if ($config['height']) {
     $config['height'] = intval($config['height']) . ($config['height'][strlen($config['height']) - 1] == '%' ? '%' : '');
 }
 //广告图片上传
 if ($config['type'] == 'img') {
     //图片上传
     $newConfigUrl = $newConfigLink = array();
     L::loadClass('advupload', 'upload', false);
     foreach ($config['imgupload'] as $key => $value) {
         if ($value != 0) {
             $img = new AdvUpload($key);
             $returnImg = PwUpload::upload($img);
             if (!is_array($returnImg) || count($returnImg) == 0) {
                 continue;
             }
             list($newConfigUrl[]) = geturl($returnImg[0]['fileuploadurl'], 'lf');
             $newConfigLink[] = $config['link'][$key];
         } else {
             $newConfigUrl[] = $config['url'][$key];
             $newConfigLink[] = $config['link'][$key];
         }
     }
     unset($config['imgupload']);
     $config['link'] = $newConfigLink;
     $config['url'] = $newConfigUrl;
 }
 foreach ($config as $key => $value) {
开发者ID:jechiy,项目名称:PHPWind,代码行数:31,代码来源:setadvert.php

示例15: array

    /*
    if ($privacy && is_array($privacy)) {
    	$pwSQL = array();
    	foreach ($privacy as $key => $value) {
    		if (in_array($key, $spaceModel)) {
    			$pwSQL[] = array(
    				'uid'	=> $winduid,
    				'type'	=> 'space',
    				'key'	=> $key,
    				'value'	=> $value
    			);
    		}
    	}
    	$pwSQL && $db->update("replace INTO pw_privacy (uid, ptype, pkey, value) values " . S::sqlMulti($pwSQL));
    }
    if ($domain != $space['domain'] && $db->get_value("SELECT COUNT(*) AS sum FROM pw_space WHERE domain=" . S::sqlEscape($domain))) {
    	Showmsg('该域名已被使用!');
    }
    */
    $pwSQL = array('name' => $name, 'descript' => $descript, 'domain' => $domain, 'spacestyle' => $spacestyle, 'spacetype' => $spacetype, 'skin' => $spaceskin, 'modelset' => serialize($modelset));
    $layout && ($pwSQL['layout'] = serialize($layout));
    set_time_limit(0);
    require_once R_P . 'u/lib/spacebannerupload.class.php';
    $upload = new spaceBannerUpload($winduid);
    PwUpload::upload($upload);
    if ($img = $upload->getImgUrl()) {
        $pwSQL['banner'] = $img;
    }
    $newSpace->updateInfo($pwSQL);
    refreshto('u.php?a=set', 'operate_success');
}
开发者ID:sherlockhouse,项目名称:aliyun,代码行数:31,代码来源:set.php


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