public function uploadImage($image) { if (!is_null($image)) { $result = $this->uploader->uploadFile($image); $longUrl = $result['url']; //initialize bitly $this->initBitly(); //shorten url $this->shortUrl = $this->shortener->shortenUrl($longUrl); } }
public function upload() { if (isset($_FILES)) { $project = $_POST['project']; $parentDirCrypted = $_POST['parent']; $facade = new SystemFacade($project); $parent = $facade->decrypt($parentDirCrypted); for ($i = 0; $i < count($_FILES['file']['name']); $i++) { $fileName = $_FILES['file']['name'][$i]; $fileTmp = $_FILES['file']['tmp_name'][$i]; $fileType = $_FILES['file']['type'][$i]; $fileSize = $_FILES['file']['size'][$i]; $fileError = $_FILES['file']['error'][$i]; $uploader = new Uploader($fileName, $fileType, $fileTmp, $fileSize, $fileError); if ($uploader->uploadFile()) { $facade->manageFileName($fileName, $parent); if ($facade->createObject($parent, $uploader->getFileName(), $uploader->getRealType(), $uploader->getFileType(), $uploader->getUploadedSource())) { $facade->refreshDirectoryDate($parent); } else { echo "Couldn't save file to database."; } } else { echo $uploader->getError(); } } echo $facade->makeFileList(); } }
/** * 更新广告 */ public function actionAdUpdate($id) { $model = Ad::model()->findByPk($id); //旧图片 $old_attach = $model->attach_file; if (isset($_POST['Ad'])) { if ($_FILES['attach']['error'] == UPLOAD_ERR_OK) { $upload = new Uploader(); $upload->uploadFile($_FILES['attach']); if ($upload->_error) { $this->message('error', Yii::t('admin', $upload->_error)); return; } //删除旧图片 $upload->deleteFile($old_attach); $model->attach_file = $upload->_file_name; } $model->attributes = $_POST['Ad']; $model->create_time = time(); if ($model->save()) { $this->message('success', Yii::t('admin', 'Update Success'), $this->createUrl('index')); } } $this->render('ad_update', array('model' => $model)); }
/** * 单页更新 * * @param $id */ public function actionUpdate($id) { $model = Page::model()->findByPk($id); if (isset($_POST['Page'])) { $model->attributes = $_POST['Page']; if ($_FILES['attach']['error'] == UPLOAD_ERR_OK) { $upload = new Uploader(); $upload->_thumb_width = '200'; $upload->_thumb_height = '180'; $upload->uploadFile($_FILES['attach'], true); if ($upload->_error) { $upload->deleteFile($upload->_file_name); $upload->deleteFile($upload->_thumb_name); $this->message('error', Yii::t('admin', $upload->_error)); return; } $model->attach_file = $upload->_file_name; $model->attach_thumb = $upload->_thumb_name; } $model->create_time = $model->create_time ? $model->create_time : time(); $model->update_time = time(); if ($model->save()) { $this->redirect(array('index')); } } $this->render('update', array('model' => $model)); }
/** * 更新链接 * */ public function actionUpdate($id) { $model = $this->loadModel(); //旧logo $old_logo = $model->logo; if (isset($_POST['Link'])) { $remove = $this->_request->getParam('remove'); $model->attributes = $_POST['Link']; if ($_FILES['logo']['error'] == UPLOAD_ERR_OK) { $upload = new Uploader(); $upload->uploadFile($_FILES['logo']); if ($upload->_error) { $this->message('error', Yii::t('admin', $upload->_error)); return; } //删除旧logo $upload->deleteFile($old_logo); $model->logo = $upload->_file_name; } if ($model->save()) { $this->message('success', Yii::t('admin', 'Update Success'), $this->createUrl('index')); } } $this->render('update', array('model' => $model)); }
/** * 编辑 * * @param $id */ public function actionUpdate($id) { $model = $this->loadModel(); //旧文件 $old_file = $model->attach_file; $old_thumb = $model->attach_thumb; if (isset($_POST['Catalog'])) { $model->attributes = $_POST['Catalog']; if ($_FILES['attach']['error'] == UPLOAD_ERR_OK) { $upload = new Uploader(); $upload->uploadFile($_FILES['attach'], 'image', true); if ($upload->_error) { $upload->deleteFile($upload->_file_name); $upload->deleteFile($upload->_thumb_name); $this->message('error', Yii::t('admin', $upload->_error)); return; } //删除旧文件 $upload->deleteFile($old_file); $upload->deleteFile($old_thumb); $model->attach_file = $upload->_file_name; $model->attach_thumb = $upload->_thumb_name; } $model->update_time = time(); if ($model->save()) { $this->message('success', Yii::t('admin', 'Update Success'), $this->createUrl('index')); } } $this->render('update', array('model' => $model)); }
/** * 更新 * * @param $id */ public function actionUpdate($id) { $model = Soft::model()->findByPk($id); $model->os = explode(',', $model->os); if (isset($_POST['Soft'])) { $model->attributes = $_POST['Soft']; if ($model->os && is_array($model->os)) { $model->os = implode(',', $model->os); } //软件文件 $fileids = is_array($_POST['fileid']) ? implode(',', $_POST['fileid']) : ''; $model->fileid = $fileids; if ($_FILES['softicon']['error'] == UPLOAD_ERR_OK) { //软件图标 $upload = new Uploader(); $upload->uploadFile($_FILES['softicon']); if ($upload->_error) { $upload->deleteFile($upload->_file_name); $this->message('error', Yii::t('admin', $upload->_error)); return; } $model->soft_icon = $upload->_file_name; } else { //未改变前的软件图标 $model->soft_icon = $_POST['old_icon']; } if ($_FILES['attach']['error'] == UPLOAD_ERR_OK) { //封面图片 $upload = new Uploader(); $upload->uploadFile($_FILES['attach']); if ($upload->_error) { $upload->deleteFile($upload->_file_name); $this->message('error', Yii::t('admin', $upload->_error)); return; } $model->cover_image = $upload->_file_name; } else { //未改变前的封面图片 $model->cover_image = $_POST['old_cover']; } //关键字(即标签,只要前10个关键字作为标签) $tags = trim($_POST['Soft']['seo_keywords']); $explodeTags = array_unique(explode(',', str_replace(array(' ', ','), array('', ','), $tags))); $model->update_time = time(); if ($model->save()) { //更新标签数据 Tag::model()->updateTagData($explodeTags, array('content_id' => $model->id, 'status' => $model->status, 'type_id' => $this->_type_ids['soft'])); $this->message('success', Yii::t('admin', 'Update Success'), $this->createUrl('index')); } } $this->render('update', array('model' => $model)); }
/** * create file. * * @access public * @param integer $userId * @param array $fileData * @return array Array holds the created file * @throws Exception If file couldn't be created */ public function create($userId, $fileData) { //upload $file = Uploader::uploadFile($fileData); if (!$file) { $this->errors = Uploader::errors(); return false; } $database = Database::openConnection(); $query = "INSERT INTO files (user_id, filename, hashed_filename, extension) VALUES (:user_id, :filename, :hashed_filename, :extension)"; $database->prepare($query); $database->bindValue(':user_id', $userId); $database->bindValue(':filename', $file["filename"]); $database->bindValue(':hashed_filename', $file["hashed_filename"]); $database->bindValue(':extension', strtolower($file["extension"])); $database->execute(); //if insert failed, then delete the file if ($database->countRows() !== 1) { Uploader::deleteFile(APP . "uploads/" . $file["basename"]); throw new Exception("Couldn't upload file"); } $fileId = $database->lastInsertedId(); $file = $this->getById($fileId); return $file; }
/** * 更新 * * @param $id */ public function actionUpdate($id) { $model = Video::model()->findByPk($id); if (isset($_POST['Video'])) { $model->attributes = $_POST['Video']; //视频文件 $fileids = is_array($_POST['fileid']) ? implode(',', $_POST['fileid']) : ''; $model->fileid = $fileids; if ($_FILES['attach']['error'] == UPLOAD_ERR_OK) { //封面图片 $upload = new Uploader(); $upload->_thumb_width = 100; $upload->_thumb_height = 100; $upload->uploadFile($_FILES['attach'], true); if ($upload->_error) { $upload->deleteFile($upload->_file_name); $this->message('error', Yii::t('admin', $upload->_error)); return; } $model->cover_image = $upload->_file_name; } else { //未改变前的封面图片 $model->cover_image = $_POST['old_cover']; } $model->update_time = time(); if ($model->save()) { $this->message('success', Yii::t('admin', 'Update Success'), $this->createUrl('index')); } } $this->render('update', array('model' => $model)); }
public function upload() { require_once dirname(ROOT) . DS . 'includes' . DS . 'upload.php'; $data = array(); $data['status'] = 0; if (!empty($_FILES['myfile'])) { $folder = $_GET['folder']; $root = dirname(ROOT) . DS . $folder; $root = str_replace('/', DS, $root); $root = str_replace(DS . DS, DS, $root) . DS; $uploader = new Uploader(); $uploader->setDir($root); $uploader->setExtensions(array('jpg', 'jpeg', 'png', 'gif', 'svg', 'pdf', 'doc', 'txt', 'docx')); $uploader->setMaxSize(10); $uploader->sameName(false); if ($uploader->uploadFile('myfile')) { $data['status'] = 1; $image = $uploader->getUploadName(); $src = $folder . '/' . $image; $data['file'] = array('title' => $image, 'url' => $src, 'file_name' => $image, 'thumb' => $src, 'file_type' => 'image'); } else { $data['status'] = 0; $data['msg'] = $uploader->getMessage(); } echo json_encode($data); exit; } }
$app->container->singleton('FileGateway', function () use($app) { return new FileGateway($app->mysqli); }); $app->container->singleton('CommentGateway', function () use($app) { return new CommentGateway($app->mysqli); }); $app->container->singleton('SearchGateway', function () use($app) { return new SearchGateway($app->mysqli); }); $app->get('/', function () use($app) { $flash = isset($_SESSION['slim.flash']) ? $_SESSION['slim.flash'] : null; $app->render('frontpage.phtml', array("flash" => $flash, "title" => "Download.me - файлообменник", "maxFileSize" => $app->config('maxFileSize'), 'active' => 'home')); }); $app->post('/upload(/:async)', function ($async = false) use($app) { $uploader = new Uploader($app->config('uploadDir'), $app->FileGateway); $id = $uploader->uploadFile($_FILES); if ($id && !$async) { $app->response->redirect("/f/{$id}", 303); } elseif ($id && $async) { header("Content-Type: application/json"); echo json_encode(array('id' => $id)); } elseif (!$id && !$async) { $app->flash('error', $uploader->getError()); $app->response->redirect('/', 303); } }); $app->get('/upload-progress', function () use($app) { $uploader = new Uploader($app->config('uploadDir'), $app->FileGateway); $data = $uploader->getUploadProgress(); if ($data) { $data['ok'] = true;
require_once ROOT . DS . 'includes' . DS . 'functions.php'; $dg = new dg(); $lang = $dg->lang(); switch ($type) { case 'upload': require_once ROOT . DS . 'includes' . DS . 'upload.php'; $data = array(); $data['status'] = 0; if (!empty($_FILES['myfile'])) { $root = $dg->folder(); $uploader = new Uploader(); $uploader->setDir(ROOT . DS . $root); $uploader->setExtensions(array('jpg', 'jpeg', 'png', 'gif')); $uploader->setMaxSize(10); $uploader->sameName(false); if ($uploader->uploadFile('myfile')) { $data['status'] = 1; $image = $uploader->getUploadName(); $data['src'] = $root . '/' . $image; $data['src'] = str_replace(DS, '/', $data['src']); $data['item'] = array('title' => $image, 'url' => $data['src'], 'file_name' => $image, 'thumb' => $data['src'], 'file_type' => 'image'); } else { $data['status'] = 0; $data['msg'] = $uploader->getMessage(); //get upload error message } } echo json_encode($data); exit; break; case 'uploadIE':
public function save() { $dgClass = new dg(); if (!empty($_POST)) { $art = $_POST['art']; if (isset($_FILES["file"]["name"]) && $_FILES["file"]["name"] != '') { // create folder $root = dirname(ROOT) . DS . 'uploaded' . DS . 'cliparts' . DS . $art['cate_id']; if (!file_exists($root)) { mkdir($root, 0755, TRUE); } $upload_path = $root . DS . 'print' . DS; if (!is_dir($upload_path)) { mkdir($upload_path, 0755, TRUE); } // upload file require_once dirname(ROOT) . DS . 'includes' . DS . 'upload.php'; $uploader = new Uploader(); $uploader->setDir($upload_path); $uploader->setExtensions(array('jpg', 'jpeg', 'png', 'gif', 'svg')); $uploader->setMaxSize(10); $uploader->sameName(false); if ($uploader->uploadFile('file')) { $image = $uploader->getUploadName(); $extension = $uploader->getExtension($image); $extension = strtolower($extension); $url = site_url('uploaded/cliparts/'); $url = str_replace('/admin/', '/', $url); $art['file_type'] = $extension; $art['file_name'] = $image; $art['path'] = $url; $art['url'] = $url . $art['cate_id'] . '/'; // create folder thumb $thumbs = $root . DS . 'thumbs'; if (!is_dir($thumbs)) { mkdir($thumbs, 0755, TRUE); } $medium = $root . DS . 'medium'; if (!is_dir($medium)) { mkdir($medium, 0755, TRUE); } if ($extension == 'svg') { $art['change_color'] = 1; $art['thumb'] = 'print/' . $image; $art['medium'] = 'print/' . $image; } else { require_once ROOT . DS . 'includes' . DS . 'thumb.php'; $thumb = new thumb($upload_path . $image); $thumb->resize(null, 100, 100, $thumbs . DS . md5($image) . '.' . $extension); $thumb->resize(null, 300, 300, $medium . DS . md5($image . 'medium') . '.' . $extension); $art['thumb'] = 'thumbs/' . md5($image) . '.' . $extension; $art['medium'] = '/medium/' . md5($image . 'medium') . '.' . $extension; $art['change_color'] = 0; } } else { echo $uploader->getMessage(); } } $art['price'] = (double) $art['price']; $file = dirname(ROOT) . DS . 'data' . DS . 'arts.json'; // check file if (!file_exists($file)) { $dgClass->redirect('index.php/clipart'); return; } $data = file_get_contents($file); $arts = json_decode($data); $is_new = true; $conent = array(); if (isset($_POST['id']) && $_POST['id'] > 0) { $id = $_POST['id']; // update clipart if (isset($arts->arts) && count($arts->arts) > 0) { foreach ($arts->arts as $row) { if ($row->clipart_id == $id) { $art['clipart_id'] = $id; $conent[] = $art; $is_new = false; } else { $conent[] = $row; } } } } if ($is_new === true) { $index = 0; foreach ($arts->arts as $row) { if ($row->clipart_id > $index) { $index = $row->clipart_id; } $conent[] = $row; } $art['clipart_id'] = $index + 1; $conent[] = $art; $arts->count = $arts->count + 1; } $arts->arts = $conent; $dgClass->WriteFile($file, json_encode($arts)); $dgClass->redirect('index.php/clipart'); } else { $dgClass->redirect('index.php/clipart'); } }
/** * 上传文件(单个不能超过设置的值) */ public function actionFile() { if ($this->method() == 'POST') { $adminiUserId = Yii::app()->user->id; $file = new Uploader(); //$file->_allow_exts = 'pdf,doc,docx,xls,ppt,exe,zip,tar,gz,msi,7z'; //普通文件类型限制 //$file->_allow_exts .= ',mp3,mp4,wma'; //音频文件 //$file->_allow_exts .= ',swf,mv,avi,mp4,flv,rmvb,mov,asf,wmv,3GP,ra,rm'; //视频文件 $file->_rand_name = false; //用原来的名称 if (is_array($_FILES['file']) && !empty($_FILES['file'])) { foreach ($_FILES['file'] as $value) { if (is_array($value)) { $files = $_FILES['file']; } else { $files = array($_FILES['file']); } break; } } else { exit(CJSON::encode(array('state' => 'error', 'message' => Yii::t('admin', 'Please select a file.')))); } foreach ($files as $simplefile) { $file->uploadFile($simplefile); if ($file->_error) { exit(CJSON::encode(array('state' => 'error', 'message' => Yii::t('admin', $file->_error)))); } else { $model = new Upload(); $model->user_id = intval($adminiUserId); $model->file_name = $file->_file_name; $model->thumb_name = $file->_thumb_name; $model->real_name = $file->_real_name; $model->file_ext = $file->_file_ext; $model->file_mime = $file->_mime_type; $model->file_size = $file->_file_size; $model->create_time = time(); if ($model->save()) { exit(CJSON::encode(array('state' => 'success', 'realname' => $file->_real_name, 'fileId' => $model->id))); } else { $file->deleteFile($file->_file_name); exit(CJSON::encode(array('state' => 'error', 'message' => Yii::t('admin', 'Save failed, Upload error')))); } } } } }
/** * 更新 * * @param $id */ public function actionUpdate($id) { $model = Image::model()->findByPk($id); if (isset($_POST['Image'])) { $model->attributes = $_POST['Image']; //标题样式 $title_style = $this->_request->getPost('style'); if ($title_style['bold'] != 'Y') { unset($title_style['bold']); } if ($title_style['underline'] != 'Y') { unset($title_style['underline']); } if (!$title_style['color']) { unset($title_style['color']); } if ($title_style) { $model->title_style = serialize($title_style); } else { $model->title_style = ''; } if ($_FILES['attach']['error'] == UPLOAD_ERR_OK) { //新上传的封面图片 $upload = new Uploader(); $upload->_thumb_width = 300; $upload->_thumb_height = 300; $upload->uploadFile($_FILES['attach'], true); if ($upload->_error) { $upload->deleteFile($upload->_file_name); $upload->deleteFile($upload->_thumb_name); $this->message('error', Yii::t('admin', $upload->_error)); return; } $model->attach_file = $upload->_file_name; $model->attach_thumb = $upload->_thumb_name; } else { //未改变前的封面图片 $model->attach_file = $_POST['old_file']; $model->attach_thumb = $_POST['old_thumb']; } //组图 $imageList = $this->_request->getPost('imageList'); $imageListSerialize = $this->imageListSerialize($imageList); $model->image_list = $imageListSerialize['dataSerialize']; //标签 (前10个标签有效) $tags = trim($_POST['Image']['tags']); $explodeTags = array_unique(explode(',', str_replace(array(' ', ','), array('', ','), $tags))); $explodeTags = array_slice($explodeTags, 0, 10); $model->tags = implode(',', $explodeTags); $model->update_time = time(); if ($model->save()) { //更新标签数据 foreach ((array) $explodeTags as $value) { if ($value) { $model_tag = new Tag(); $get_tags = $model_tag->find('tag_name=:tagname', array(':tagname' => $value)); if ($get_tags) { $tag_id = $get_tags->id; } else { $model_tag->data_count = 1; $model_tag->tag_name = $value; $model_tag->save(); $tag_id = $model_tag->id; } //添加关联表数据 $tagData = TagData::model()->findByPk(array('tag_id' => $tag_id, 'content_id' => $model->id)); if (!$tagData) { $tagData = new TagData(); $tagData->tag_id = $tag_id; $tagData->content_id = $model->id; $tagData->type = $this->_type_ids['image']; $tagData->save(); } } } //更新关联的标签 $tagData = TagData::model()->updateAll(array('status' => $model->status), 'content_id =:id AND type =:type', array(':id' => $model->id, ':type' => $this->_type_ids['image'])); $this->message('success', Yii::t('admin', 'Update Success'), $this->createUrl('index')); } } else { $imageList = unserialize($model->image_list); $style = unserialize($model->title_style); } $this->render('update', array('model' => $model, 'imageList' => $imageList, 'style' => $style)); }
<?php $_GRUNT_PATH = 1; require_once '../GruntFileSystem.php'; if (isset($_FILES)) { $project = $_POST['project']; $parentDirCrypted = $_POST['parent']; $facade = new SystemFacade($project); $parent = $facade->decrypt($parentDirCrypted); for ($i = 0; $i < count($_FILES['file']['name']); $i++) { $fileName = $_FILES['file']['name'][$i]; $fileTmp = $_FILES['file']['tmp_name'][$i]; $fileType = $_FILES['file']['type'][$i]; $fileSize = $_FILES['file']['size'][$i]; $fileError = $_FILES['file']['error'][$i]; $uploader = new Uploader($fileName, $fileType, $fileTmp, $fileSize, $fileError); if ($uploader->uploadFile()) { $facade->manageFileName($fileName, $parent); if ($facade->createObject($parent, $uploader->getFileName(), $uploader->getRealType(), $uploader->getFileType(), $uploader->getUploadedSource())) { $facade->refreshDirectoryDate($parent); } else { echo "Couldn't save file to database."; } } else { echo $uploader->getError(); } } echo $facade->makeFileList(); }
} elseif ($route->match('iconimgupload', null)) { // Prepare and sanitize post input $api->setInputs($_POST); $icon = $model->iconFind(array('id' => $api->getInputVal('id'), 'user_id' => $user->id)); if (!$icon) { $response->status = 404; $response->message = 'Not found'; $response->json($response); } $uploader = new Uploader(); $uploader->setDir('storage/icons/'); $uploader->setExtensions(array('png', 'jpg', 'gif')); //allowed extensions list// $uploader->setMaxSize(0.2); $uploader->setCustomName($icon->name . '-' . $api->getInputVal('id') . '-' . time()); if (!$uploader->uploadFile('file')) { $response->status = 500; $response->message = $uploader->getMessage(); $response->json($response); } $model->iconUpdate(array('icon' => $uploader->getUploadName(), 'updated_at' => date("Y-m-d H:i:s")), array('id' => $icon->id)); $path = 'storage/icons/' . $api->getInputVal('current'); if (is_file($path)) { unlink($path); } $response->data = array('icon' => $uploader->getUploadName()); $response->json($response); } elseif ($route->match('userread', null)) { // Prepare and sanitize post input $response->data = $model->userFind(array('id' => $user->id)); $response->json($response);
/** * 更新 * * @param $id */ public function actionUpdate($id) { $model = Post::model()->findByPk($id); if (isset($_POST['Post'])) { $model->attributes = $_POST['Post']; //标题样式 $title_style = $this->_request->getPost('style'); if ($title_style['bold'] != 'Y') { unset($title_style['bold']); } if ($title_style['underline'] != 'Y') { unset($title_style['underline']); } if (!$title_style['color']) { unset($title_style['color']); } if ($title_style) { $model->title_style = serialize($title_style); } else { $model->title_style = ''; } if ($_FILES['attach']['error'] == UPLOAD_ERR_OK) { //封面图片 $upload = new Uploader(); $upload->_thumb_width = 100; $upload->_thumb_height = 100; $upload->uploadFile($_FILES['attach'], true); if ($upload->_error) { $upload->deleteFile($upload->_file_name); $upload->deleteFile($upload->_thumb_name); $this->message('error', Yii::t('admin', $upload->_error)); return; } $model->attach_file = $upload->_file_name; $model->attach_thumb = $upload->_thumb_name; } else { //未改变前的封面图片 $model->attach_file = $_POST['old_file']; $model->attach_thumb = $_POST['old_thumb']; } //组图 $imageList = $this->_request->getPost('imageList'); $imageListSerialize = $this->imageListSerialize($imageList); $model->image_list = $imageListSerialize['dataSerialize']; //标签 (前10个标签有效) $tags = trim($_POST['Post']['tags']); $explodeTags = array_unique(explode(',', str_replace(array(' ', ','), array('', ','), $tags))); $explodeTags = array_slice($explodeTags, 0, 10); //摘要 $model->introduce = trim($_POST['Post']['introduce']) ? $_POST['Post']['introduce'] : Helper::truncate_utf8_string(preg_replace('/\\s+/', ' ', $_POST['Post']['content']), 200); $model->tags = implode(',', $explodeTags); $model->update_time = time(); if ($model->save()) { //更新标签数据 Tag::model()->updateTagData($explodeTags, array('content_id' => $model->id, 'status' => $model->status, 'type_id' => $this->_type_ids['post'])); $this->message('success', Yii::t('admin', 'Update Success'), $this->createUrl('index')); } } else { $imageList = unserialize($model->image_list); $style = unserialize($model->title_style); } $this->render('update', array('model' => $model, 'imageList' => $imageList, 'style' => $style)); }
/** * 更新 * * @param $id */ public function actionUpdate($id) { $model = Goods::model()->findByPk($id); if (isset($_POST['Goods'])) { $model->attributes = $_POST['Goods']; if ($_FILES['attach']['error'] == UPLOAD_ERR_OK) { //封面图片 $upload = new Uploader(); $upload->_thumb_width = 300; $upload->_thumb_height = 300; $upload->uploadFile($_FILES['attach'], true); if ($upload->_error) { $upload->deleteFile($upload->_file_name); $upload->deleteFile($upload->_thumb_name); $this->message('error', Yii::t('admin', $upload->_error)); return; } $model->default_image = $upload->_file_name; $model->default_thumb = $upload->_thumb_name; } //组图 $imageList = $this->_request->getPost('imageList'); $imageListSerialize = $this->imageListSerialize($imageList); $model->image_list = $imageListSerialize['dataSerialize']; //更新时间 $model->update_time = time(); if ($model->save()) { $this->message('success', Yii::t('admin', 'Update Success'), $this->createUrl('index')); } } else { $imageList = unserialize($model->image_list); } $this->render('update', array('model' => $model, 'imageList' => $imageList)); }