本文整理匯總了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);
}
}