本文整理汇总了PHP中UploadFile::uploadImg方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadFile::uploadImg方法的具体用法?PHP UploadFile::uploadImg怎么用?PHP UploadFile::uploadImg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UploadFile
的用法示例。
在下文中一共展示了UploadFile::uploadImg方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editAction
public function editAction()
{
if (Session::hasUser('admin')) {
$indexModel = new IndexModel();
$data_page = $indexModel->getPage(Router::getId(), Router::getLanguage(), $this->material_type);
$menuModel = new MenuModel();
$data = $menuModel->getMainMenu('uk');
$menuController = new MenuController();
$main_menu_array = $menuController->menuArray($data);
$data_menu_item = $menuModel->getMenuDatePage($data_page[0]['id']);
$redirect_status = null;
$request = new Request();
$editModel = new AddEditModel($request, $this->material_type);
if ($request->isPost()) {
if ($editModel->isValid()) {
if ($editModel->isAliasExist($data_page[0]['id'])) {
if ($editModel->inMenu()) {
$file_data = array('max_image_size' => Config::get('max_image_size'), 'max_image_width' => Config::get('max_image_width'), 'max_image_height' => Config::get('max_image_height'));
$fileUpload = new UploadFile($request, $file_data);
$redirect_status = $fileUpload->uploadImg($request, $this->material_type);
if ($redirect_status) {
$editModel->edit($data_page[0]['id']);
}
} else {
$with_without_menu = 1;
$editModel->edit($data_page[0]['id'], $with_without_menu);
}
} else {
Session::setFlash('Документ с таким псевдонимом уже существует!');
}
} else {
Session::setFlash('Поле "Заголовок" обязательно для заполнения');
}
}
$this->rewrite_file_alias();
$args = array('data_page' => $data_page, 'data_menu' => $main_menu_array, 'edit_model' => $editModel, 'data_menu_item' => $data_menu_item, 'redirect' => $request->post('redirect'), 'redirect_status' => $redirect_status, 'without_menu' => $request->post('without_menu'), 'menu_disable' => Config::get('menu_disable'), 'id' => $data_page[0]['id']);
$tpl = 'edit' . str_replace(' ', '', ucwords(str_replace('_', ' ', $this->material_type)));
return $this->render_admin($args, $tpl);
} else {
throw new Exception('Access denied', 403);
}
}