CUploadedFile problem

I need a solution in approaching my requirement, I am developing an application where users can upload their image or users can upload images in bulk by specifying directory.

When user uploading a single image i am following the below approach to copy image to server and to get image properties




$file=CUploadedFile::getInstance($model,'image');

$model->image_path='images/searchimages/'.$model->category.'/'.$file->name;

list($width, $height, $type, $attr)=getimagesize($file->tempName);

$model->save()

$model->image->saveAs($model->image_path);



Now when user goes to second option bulk upload where they will specify a directory, i have to scan directory and need to copy files to server, where as here user is not uploading images, he is just specifying directory name to upload all this images . Now how can i use CUploadedFile::getInstance to get image in this scenario.

anyone?