I have a multifile upload form, all works fine, if I select the files one by one, all appears behind the browser button, but if I select multiples files when I am browsing only appears the first one, why can it be?
VIEW:
$this->widget('CMultiFileUpload', array(
'name' => 'docs_multiple',
'model'=>$model,
'attribute'=>'doc_ruta',
'accept'=>'pdf',
'duplicate' => 'Ya esta.', // useful, i think
'denied'=>'Archivo erróneo.',
'htmlOptions' => array('multiple' => 'multiple'),
'max'=>10, // max 10 files
));
CONTROLLER:
if (isset($files) && count($files) > 0) {
// go through each uploaded image
foreach ($files as $archivo => $arc) {
echo $arc->name.'<br />';
$rnd = rand(0,9999);
$fileName = "{$rnd}-{$arc->name}";
if ($arc->saveAs(Yii::app()->basePath.'\..\uploads\\'.$fileName)) {
$add_file = new ZfDocumentacionInmueble;
$add_file->doc_titulo = $arc->name;
$add_file->doc_ruta = $fileName;
$add_file->zf_inmuebles_inmueble_id = $model->zf_inmuebles_inmueble_id;
$add_file->doc_fecha_subida = $fecha_ini;
$add_file->save(); // DONE
}
else{
echo 'No se pudo subir.';
}
}
$this->redirect(array('//ZfInmuebles'));
}else{
if($model->save())
$this->redirect(array('ZfDocumentacionInmueble/index'));
}