File uploading but not to dynamic directory

For a file upload I have the action below. This creates a dir with the currentDate as I have defined in my model and a uploads my file renaming it to the ImageId.

The problem is that the directory and Image are both created within the same dir. I need the Image to be placed in the newly created directory though. Any ideas?


$model->attributes=$_POST['ImageUpload'];

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

if($model->save())

{

	exec("mkdir -p " . Yii::app()->basePath . "/../images/uploads/$data->currentDate");

	$model->image->saveAs(Yii::app()->getBasePath()."/../images/uploads/$data->currentDate/$model->ImageId");

	$this->redirect(array('view', 'id' => $model->ImageId));

}

create directory before upload