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?





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


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


create directory before upload