Here below is the kartik file input widget in update_form.
echo FileInput::widget(
[
'name' => 'BriefRequirements[requirement_value][]',
'attribute' => 'assets_file',
'id' => 'assets_file',
'options' => ['multiple' => true],
'pluginOptions' => [
'overwriteInitial' => false,
'initialPreview' => $image_url,
'deleteUrl' => ' site/delete',
'initialPreviewAsData' => true,
'initialPreviewFileType' => 'image' //'pdf'
]
]
);
below is multiple image loading code,
foreach ($modelRequirements as $req) {
$image_url[] = Yii::$app->request->baseUrl
. '/theme/business_campaign_files/'
. $req['requirement_value'];
}
I need help with my two questions:
Need to show all selected format files like image, pdf, doc etc [I tried to like
'initialPreviewFileType'=>'any'
] not working.I want to pass the selected image id to action to delete the image? -
'deleteUrl' => ' site/delete'
,'id'=>12
, <-- like this.
In the below code i got the result for my two questions.
In the above code i got the result for my two questions.
For delete -> mentioned url I wrote the delete function, also through key parameter I passed the id.
For view all the extension files u have to send like "type"
$initializeConfig1['type'] = $type;
in the type variable i am getting the image extension based on the extension i am setting the format of the filelike[pdf,xlsx,image]
.easyOne