-
Notifications
You must be signed in to change notification settings - Fork 13
Configuring File Uploads
Coackroach edited this page Apr 12, 2019
·
1 revision
You can configure file upload field by using the type
option under the fieldConfig
and if you want to support multiple file uploads then you should use the multifield
as true
under the specific field to support multiple file uploads, otherwise omit it.
[
'model'=>$model
'title'=>'Images',
'description'=>'Give us the details of the list',
'formInfoText'=>'Fill all required fields',
'fieldConfig' => [
'image' => [
'type'=>'file',
'multifield'=>true,
]
]
],
For using the widget you dont need to configure the type
property for the field, but if you want the multiple file uploads then you should specify the "multifield"=>true
, otherwise omit.
See the below code where you can use the kartik\FileInput
widget
[
'model'=>$model,
'title'=>'Images',
'description'=>'Give us the details of the list',
'formInfoText'=>'Fill all required fields',
'fieldConfig' => [
'image' => [
'multifield'=>true,
'widget' => FileInput::classname(),
'options' =>[
'options' => [
'multiple' => true,
'accept' => 'image/*',
'pluginOptions' => [
'showCaption' => false,
'showRemove' => false,
'showUpload' => false,
'browseClass' => 'btn btn-primary btn-block',
'browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ',
'browseLabel' => 'Attach Listing Images',
'allowedFileExtensions' => ['jpg','gif','png'],
'overwriteInitial' => false
],
],
],
]
]
],
- Get Running with Minimal Options
- Disable ActiveForm Validation
- Enable Ajax Validation
- Add Custom Buttons
- Widget Constants
- Customizing Form Fields
- Configuring File Uploads
- Custom Field Order
- Single Model Across Steps
- Multiple models in a single step
-
Tabular Steps-(New)
- Working With Widgets
- Limiting Rows
- Dependent Inputs Since v1.7.2
- Skip-able Step-(Since v1.5.0)
- Enable Preview Step-(New)
- Group Fields-(New)
- Enable Form Persistence-(New)
- Enable Edit Mode - (Since v1.6.4)