I trying the Multiple upload things, I did the example in 106 single file upload, it works totally fine, then I try to multiple update files like code on page 109, it does not work. looks like there is validate problem, I always get $model->validate() false, with errors like this:
Hi, it does not work for me too. i tried with the getInstances method, it returns an array of files, but it does not work also. The error is file cannot be blank.
This uploads the files but does no validation upon either of the files selected. Not a good solution. The author should comment how to fix this obviously this code hasn’t been tested before written in the book.
hello my first response to the forum, always read he never contributes, c’mon
I to using a multiupload with multiple files
so do not know if it actually looked rather more follows the MVC pattern code
#Model
public function rules()
{
return array(
...
array('picture', 'pictureRule'),
.. );
}
public function pictureRule()
{
$picture_test=CUploadedFile::getInstancesByName('picture');
if(empty($picture_test))
{
$this->addError('pictureRule', 'Error not file blank!');
return false;
}else{
return true;
}
}
#Controler
*remember to put that part of the instance file after validation
* i use [url="http://www.yiiframework.com/extension/euploadedimage/"]EUploadImage[/url] extension for good make thumbs
public function actionCreate()
{
$model=new Produts;
if(isset($_POST['Produts']))
{
$model->attributes=$_POST['Produts'];
if($model->validate()){
$picture = EUploadedImage::getInstancesByName('picture');