Closed raphaelM-sudo closed 7 years ago
Read this webtip for setting up and using FileInput widget.
Your form must have the enctype
set for files to be read by your PHP server code:
$form = ActiveForm::begin([
'options'=>['enctype'=>'multipart/form-data'] // important
]);
You may want to do some reading on generic HTML form settings for native file upload via PHP
Hi Kartik.
I am trying to implement an image upload functionality on form submit, using your FileInput widget, but UploadedFile::getInstances is always returning null inside the controller. I tried kartik\widgets\FileInput and kartik\file\FileInput, but it does not work both ways. The versions I am using are: yii2-widgets v3.4.0 and yii2-widget-fileinput v1.0.5. When I use the yii2 ActiveField fileInput it works.
I tried this basic example:
Model:
View:
Controller:
My actual model, view and controller is more complex, but it does not work with this simple one either. At first I tried multiple file upload and after I could not find the error, I was trying single file upload.
I hope you can help me, thanks in advance