Advertisement
yacel100

formulario de multiupload

Jun 19th, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.58 KB | None | 0 0
  1. <?php
  2. /* @var $this FormatoVideoController */
  3. /* @var $model FormatoVideo */
  4. /* @var $form CActiveForm */
  5. ?>
  6.  
  7. <div class="form">
  8. <?php $form=$this->beginWidget('CActiveForm', array(
  9.     'id'=>'video-form',
  10.         //'enableAjaxValidation'=>true,
  11.     //'enableClientValidation'=>false,
  12.     //'clientOptions'=>array('validateOnSubmit'=>true),
  13.     'focus'=>'input:visible:enabled:first',
  14.     'htmlOptions' => array('enctype' => 'multipart/form-data'),
  15. )); ?>
  16.  
  17.     <p class="note">Los siguientes campos que tenga <span class="required">*</span> son requeridos.</p>
  18.  
  19.  
  20. <?php
  21. $items=array(1,2);
  22. foreach($numero as $i=>$item): ?>
  23.  
  24. <div class="row">
  25.  
  26.     <?php //if($uploaded):?>
  27.     <p>El archivo a sido subido. Verficado <?php //echo $dir?>.</p>
  28.     <?php //endif ?>
  29.     <?php echo $form->labelEx($model,'url_arc');?>
  30. <?php $this->widget('CMultiFileUpload', array(
  31.     'name' => 'url_arc',
  32.     'accept' => 'jpeg|jpg|gif|png',
  33.     'duplicate' => 'Archivo esta duplicado!',
  34.     'denied' => 'Invalido tipo de archivo',
  35.     'max'=>'1',
  36.     'remove'=> 'REMOVER',
  37. ));
  38. ?>
  39. <?php echo $form->error($model, 'url_arc'); ?>
  40.     </div>
  41. <?php endforeach; ?>
  42.     <div class="row buttons">
  43.         <?php echo CHtml::submitButton($model->isNewRecord ? 'Guardar' : 'Save'); ?>
  44.     </div>
  45.  
  46. <?php $this->endWidget(); ?>
  47.  
  48. </div><!-- form -->
  49. for($i;$i<=5;$i++)
  50. {
  51.     if(isset($_POST['personas'[$i]]))
  52.     {
  53.         $model=new personas;
  54.         $model->attributes=($_POST['personas'][$i]);
  55.         $model->save();
  56.     }
  57. }
  58.  
  59. en el formulario
  60.  
  61. $form->textField($model,'[$i]nombre')..
  62.  
  63.  
  64. wiki/362/how to use multiple instances of the same model in the same form
  65. 7
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement