CUploadedFile::getInstance() strange behavior

Good day!

For example, if we have CMultiFileUpload with name=>ProductImage[imageFile],

then first uploaded file $name in CUploadedFile::getInstance() will be ProductImage[0][imageFile], but it have to be ProductImage[imageFile][0], isnt it?

Or am i not understanding a thing?

usage:



foreach ($_FILES['ProductImage']['name']['imageFile'] as $key=>$file) {


    $productImage = new ProductImage;


    $image = CUploadedFile::getInstance($productImage,"imageFile[$key]");


}


CUploadedFile::getInstance() piece:

$name=get_class($model).substr($attribute,$pos).'['.substr($attribute,0,$pos).']';

Yeah, right now CMultiFileUpload doesn't work with CUploadedFile. You need to manually manipulate $_FILES.

Ok then.

One more thing. This approach:

CUploadedFile::getInstance($someModel, "attributeName[$i]");

which mentioned in documentation, is for manually generated tabular input with several Chtml::activeFileField(), am i right?

Yes.

Thanks a lot!