Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Dec 23rd, 2012  |  syntax: PHP  |  size: 0.48 KB  |  hits: 33  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //_form.php
  2.                         <?php
  3.                         $this->widget('CMultiFileUpload',array(
  4.                                 'model'=>$model,
  5.                                 'attribute'=>'files',
  6.                                 'accept'=>'jpg|gif|png',
  7.                         ));
  8.                         ?>
  9. //Model.php
  10.  
  11. class Post extends CActiveRecord
  12. {
  13.     const STATUS_UNPUBLISHED=0;
  14.     const STATUS_PUBLISHED=1;
  15.     const STATUS_STICKY=2;
  16.  
  17.    public $files;
  18.  
  19. }
  20.  
  21. //Controller.php
  22.  
  23.  
  24. //action
  25.  
  26. $model->files=CUploadedFile::getInstances($model,'files');
  27. foreach($models->files as /** @var CUploadedFile $file */$file) {...}