Answer the question
In order to leave comments, you need to log in
Yii2 no file when loading image?
Hello.
Generated via CRUD forms. You need to upload images. In the database field 'VARCHAR'. advanced template.
In the 'Team' model I add:
use yii\base\models;
use yii\web\UploadedFile;
...........................................
[['photo_team'], 'file'],
<?= $form->field($model, 'photo_team')->fileInput() ?>
<?= $form->field($model, 'party')->dropDownList([ 'A' => 'A', 'B' => 'B', 'C' => 'C', 'D' => 'D', 'E' => 'E', 'F' => 'F', ], ['prompt' => '']) ?>
Answer the question
In order to leave comments, you need to log in
1. To develop on yii2, you need to enable the debug panel to see errors.
2. Most likely a problem with form validation.
3. Give the full codes, models, views with the form and the controller that processes it.
4.
I remove everything from backend/views/team/_form.php - the form is as it was - it is.- whatoooo is that? Write more in Russian. What does "the form as it was - so it is" mean? Where there is? In the browser in code?
I'm cleaning everything- What is this?
If you clear the backend/views/team/_form.php file and there are no changes on the page, then you are working with the wrong file
Try using kartik widgets.
on my page like this:
echo \kartik\widgets\FileInput::widget([
'name' => 'attachment',
'pluginOptions' => [
'showPreview' => false,
'showCaption' => true,
'showRemove' => true,
'showUpload' => true,
'uploadUrl' => \yii\helpers\Url::to(['/report/report-upload'])
]
]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question