本文整理汇总了PHP中PwUpload::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP PwUpload::execute方法的具体用法?PHP PwUpload::execute怎么用?PHP PwUpload::execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PwUpload
的用法示例。
在下文中一共展示了PwUpload::execute方法的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');
}
示例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');
}
示例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');
}
示例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);
}
示例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');
}
示例6: 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');
}
示例7: _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']);
}
示例8: 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, '更新成功');
}
}
示例9: doimportAction
public function doimportAction()
{
Wind::import('SRV:upload.action.PwWordUpload');
Wind::import('LIB:upload.PwUpload');
$bhv = new PwWordUpload();
$upload = new PwUpload($bhv);
if (($result = $upload->check()) === true) {
$result = $upload->execute();
}
if ($result !== true) {
$error = $result->getError();
if (is_array($error)) {
list($error, ) = $error;
if ($error == 'upload.ext.error') {
$this->showError('WORD:ext.error');
}
}
$this->showError($result->getError());
}
$source = $bhv->getAbsoluteFile();
if (!WindFile::isFile($source)) {
$this->showError('operate.fail');
}
$content = WindFile::read($source);
pw::deleteAttach($bhv->dir . $bhv->filename, 0, $bhv->isLocal);
$content = explode("\n", $content);
if (!$content) {
$this->showError('WORD:import.data.empty');
}
$wordService = $this->_getWordService();
$typeMap = $this->_getWordDS()->getTypeMap();
Wind::import('SRV:word.dm.PwWordDm');
foreach ($content as $value) {
list($word, $type, $replace) = $this->_parseTextUseInImport($value, $typeMap);
if (!$word || !$type || $wordService->isExistWord($word)) {
continue;
}
$dm = new PwWordDm();
/* @var $dm PwWordDm */
$dm->setWord($word)->setWordType($type);
$replace = $this->_getWordDS()->isReplaceWord($type) ? $replace ? $replace : '****' : '';
$dm->setWordReplace($replace);
$this->_getWordDS()->add($dm);
}
$this->_getWordFilter()->updateCache();
$this->showMessage('success');
}
示例10: _uploadImage
private function _uploadImage($key = 'image')
{
Wind::import('SRV:upload.action.PwMedalUpload');
Wind::import('LIB:upload.PwUpload');
if ($key == 'image') {
$bhv = new PwMedalUpload('image', 80, 80);
} else {
$bhv = new PwMedalUpload('icon', 30, 30);
}
$upload = new PwUpload($bhv);
if (($result = $upload->check()) === true) {
$result = $upload->execute();
}
if ($result !== true) {
$this->showError($result->getError());
}
return $bhv->getAttachInfo();
}
示例11: uploadOptionImage
/**
* 上次投票项图片
*
*/
public function uploadOptionImage()
{
Wind::import('SRV:upload.action.PwPollUpload');
Wind::import('SRV:upload.PwUpload');
$bhv = new PwPollUpload($this->user);
$upload = new PwUpload($bhv);
if (($result = $upload->check()) === true) {
$result = $upload->execute();
}
if ($result !== true) {
return $result == false ? new PwError('operate.fail') : $result;
}
return $bhv->getAttachInfo();
}
示例12: _upload
private function _upload($portalId = 0)
{
Wind::import('SRV:upload.action.PwPortalUpload');
Wind::import('LIB:upload.PwUpload');
$bhv = new PwPortalUpload($portalId);
$upload = new PwUpload($bhv);
if (($result = $upload->check()) === true) {
$result = $upload->execute();
}
if ($result !== true) {
$this->showError($result->getError());
}
return $bhv->getAttachInfo();
}
示例13: _uploadFile
private function _uploadFile($key, $moduleid = 0)
{
Wind::import('SRV:upload.action.PwDesignDataUpload');
Wind::import('SRV:upload.PwUpload');
$bhv = new PwDesignDataUpload($key, $moduleid);
$upload = new PwUpload($bhv);
if (($result = $upload->check()) === true) {
$result = $upload->execute();
}
if ($result !== true) {
$this->showError($result->getError());
}
$image = $bhv->getAttachInfo();
return $image['filename'] ? Pw::getPath($image['path'] . $image['filename']) : "";
}
示例14: _upload
/**
* 上传
*
* @param string $key
* @return string
*/
private function _upload($key)
{
Wind::import('SRV:upload.action.PwIconUpload');
Wind::import('LIB:upload.PwUpload');
$bhv = new PwIconUpload($key, 'background/');
$upload = new PwUpload($bhv);
$r = $upload->execute();
if ($r instanceof PwError) {
$this->showError($r->getError());
}
return $bhv->getAttachInfo();
}
示例15: saveIcon
/**
* 上传图标
*
* @return string
*/
private function saveIcon()
{
Wind::import("SRV:upload.action.PwTaskIconUpload");
Wind::import('LIB:upload.PwUpload');
$taskUpload = new PwTaskIconUpload(80, 80);
$upload = new PwUpload($taskUpload);
if (($result = $upload->check()) === true) {
$result = $upload->execute();
}
if ($result !== true) {
$this->showError($result->getError());
}
$path = $taskUpload->getPath();
return $path ? $path : $this->getInput('oldicon');
}