I am working on multiple file uploads using CMultiFileUpload like shown on the view form below.
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'postads-form',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
'action' => Yii::app()->createUrl('mytest/upload'),
'htmlOptions' => array('enctype' => 'multipart/form-data'),
)); ?>
...
<div class="row">
<?php echo $form->labelEx($picha,'images'); ?>
<?php
$this->widget('CMultiFileUpload', array(
'model'=>$picha,
'attribute'=>'images',
'accept' => 'gif|jpg|png',
'max' => 10,
'duplicate' => 'Duplicate file!',
'denied' => 'Invalid file type',
'options'=>array( ),
));
?>
<?php echo $form->error($picha,'images'); ?>
In the controller this is what i have, it’s not complete i
public function actionUpload(){
$ckimg = new CkImages;
if (isset($_POST['CkImages'])) {
$ckimg->attributes = $_POST['CkImages'];
var_dump($ckimg->attributes);
}
}
$_POST does not work when i have ‘htmlOptions’ => array(‘enctype’ => ‘multipart/form-data’), set. When i comment it
POST is working but i need it in order to access the files.
Has anyone ever encountered such a strange behavior and how do you solve it.