0

When I use the var_dump to see the result if I call the name of the file input in the controller I get this error:

/app/backend/controllers/WithMeetingTrait.php:84:null

This is the view:

<div class="custom-file">
  <input type="file" name="image" class="custom-file-input" id="inputGroupFile01" >
  <label class="custom-file-label" for="inputGroupFile01"><?= Yii::t('app', 'Choose file(s)...') ?></label>
</div>

and this is the controller:

 exit(var_dump(UploadedFile::getInstanceByName( 'image')));

I also tried to do this:

exit(var_dump($_FILES["image"]));

But the result is:

enter image description here

I don't use a model in this part of project.

Core972
  • 4,065
  • 3
  • 31
  • 45
adnen manssouri
  • 51
  • 2
  • 11
  • 1
    See what's in $_FILES (don't use var_dump in exit, var_dump is a void function) and also did you put ['options' => ['enctype' => 'multipart/form-data']] in your ActiveForm? – Vladimir Dec 30 '19 at 09:47
  • I use `var_dump` in `exit` to get the result returned with by the name of the form, it is true that I miss `['options' => ['enctype' => 'multipart / form-data' ]]` but `$ _FILES` is still empty. Although `$ _POST` returned the result correctly – adnen manssouri Dec 30 '19 at 10:48
  • @adnenmanssouri please show us your form codes. – ttrasn Dec 30 '19 at 11:11

1 Answers1

1

The solution i found is that I don't put ['options' => ['enctype' => 'multipart / form-data']] in the correct place. Its a concentration mistake thanks for all.

adnen manssouri
  • 51
  • 2
  • 11