Renaming file before saving?

Well I have the following:


			$model->picture = CUploadedFile::getInstance($model,'picture');

			$model->picture->saveAs(Yii::app()->basePath . '/../images/uploads/' . $model->picture);




The problem is I need to rename the file before I save but since there can be mutltiple file extensions I can not simply write $model->picture->saveAs($rename . ‘.jpg’); So my question is how do I get just the file extension of my uploaded file?

I have tried using this but doesn’t quite return what I need:




$type = CUploadedFile::getType($model,'picture');



Is there anything else I can use?

CUploadedFile has a property ‘extensionName’ which might be of use:




$model->picture = CUploadedFile::getInstance($model,'picture');

$extension = $model->extensionName;



Ah I overlooked that. But just a small correction, it is actualy $extension = $model->picture->extensionName;

Thank you!

I didn’t have my morning coffee today. Can I blame it on that? :huh: