Answer the question
In order to leave comments, you need to log in
Why does the captcha not see a method for uploading an image?
Good day. There is a Site controller, it contains the code:
public function actions()
{
return [
'captcha' => [
'class' => 'yii\captcha\CaptchaAction',
'width' => 132,
'height' => 39,
'backColor' => 0xFFFFFF,
'foreColor' => 0xBABABA,
'minLength' => 6,
'maxLength' => 7,
'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
],
];
}
['verifyCode', 'captcha', 'captchaAction' => '/site/captcha'],
<div class="form">
<?php
$form = ActiveForm::begin([
'id' => 'one-form',
'enableAjaxValidation' => true,
'enableClientValidation' => false,
'validateOnSubmit' => true,
'scrollToError' => false,
'fieldConfig' => [
'template' => '{input}',
]
]);
?>
............................................
<div class="input-wrap captcha-s">
<?=
$form->field($model, 'verifyCode', ['enableAjaxValidation' => false,])->widget(Captcha::className(), [
'captchaAction' => Url::toRoute('captcha'),
'template' => '<div class="row"><div class="col-sm-8">{input}</div><div class="col-sm-4"><div class="img-s">{image}</div></div></div>',
'options' => [
'class' => 'form-control',
'autocomplete' => 'off',
'placeholder' => $model->getAttributeLabel('verifyCode'),
'style' => 'text-align: center;',
],
])->label('Please enter the security code:<span class="red">*</span>')
?>
</div>
...................................................
<?php ActiveForm::end(); ?>
...........................................
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question