exception 'yii\web\BadRequestHttpException' with message 'Unable to verify your data submission.' in C:\OpenServer\domains\tour\vendor\yiisoft\yii2\web\Controller.php:110
Stack trace:
#0 C:\OpenServer\domains\tour\vendor\yiisoft\yii2\base\Controller.php(149): yii\web\Controller->beforeAction(Object(yii\base\InlineAction))
#1 C:\OpenServer\domains\tour\vendor\yiisoft\yii2\base\Module.php(455): yii\base\Controller->runAction('create', Array)
#2 C:\OpenServer\domains\tour\vendor\yiisoft\yii2\web\Application.php(83): yii\base\Module->runAction('posts/create', Array)
#3 C:\OpenServer\domains\tour\vendor\yiisoft\yii2\base\Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))
#4 C:\OpenServer\domains\tour\backend\web\index.php(18): yii\base\Application->run()
#5 {main}
Код в контроллере вот такой:
Код: Выделить всё
public function actions()
{
return [
'error' => [
'class' => 'yii\web\ErrorAction',
],
'imageupload' => [
'class' => 'vova07\imperavi\actions\UploadAction',
'url' => '../../images/', // Directory URL address, where files are stored.
'path' => '@webroot/images/' // Or absolute path to directory where files are stored.
],
'imagesget' => [
'class' => 'vova07\imperavi\actions\GetAction',
'url' => '../../images/', // Directory URL address, where files are stored.
'path' => '@webroot/images/', // Or absolute path to directory where files are stored.
'type' => '0',
],
'filesget' => [
'class' => 'vova07\imperavi\actions\GetAction',
'url' => '../../files/', // Directory URL address, where files are stored.
'path' => '@webroot/files/', // Or absolute path to directory where files are stored.
'type' => '1',//GetAction::TYPE_FILES,
],
'fileupload' => [
'class' => 'vova07\imperavi\actions\UploadAction',
'url' => '../../files/', // Directory URL address, where files are stored.
'path' => '@webroot/files/' // Or absolute path to directory where files are stored.
],
];
}
Код: Выделить всё
<? echo $form->field($model, 'yii2_posts_content')->widget(Widget::className(), [
'settings' => [
'lang' => 'ru',
'minHeight' => 200,
'pastePlainText' => true,
'buttonSource' => true,
'plugins' => [
'clips',
'fullscreen'
],
'imageUpload' => Url::to(['/posts/imageupload']),
'imageManagerJson' => Url::to(['/posts/imagesget']),
'fileManagerJson' => Url::to(['/posts/filesget']),
'fileUpload' => Url::to(['/posts/fileupload'])
]
]);?>
Код: Выделить всё
<?= Html::csrfMetaTags() ?>
Картинка загрузилась в папку. Путь к ней http://tour/backend/images/54b6b52fa9319.jpg
Но при попытке открыть по ссылке ничего не показывает. Похоже где-то проблема в настройках?
Так вообще форма с редактором находится по ссылке http://tour/backend/web/index.php?r=posts%2Fupdate&id=3
Может проблема в .htaccess? Корневой файл выглядит так:
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
# Если запрос начинается с /admin, то заменяем на /backend/web/
RewriteCond %{REQUEST_URI} ^/admin
RewriteRule ^admin\/?(.*) /backend/web/$1
# Добавляем другой запрос /frontend/web/$1
RewriteCond %{REQUEST_URI} !^/(frontend/web|backend/web|admin)
RewriteRule (.*) /frontend/web/$1
# Если frontend запрос
RewriteCond %{REQUEST_URI} ^/frontend/web
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /frontend/web/index.php
# Если backend запрос
RewriteCond %{REQUEST_URI} ^/backend/web
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /backend/web/index.php