how to create directories for the user uploads

i want that each user has its own directory in the main uploads directory and all its uploads are saved in there

how can i create a directories for the users in the yii

is there any way to do that?

You can use the php function mkdir() for that.

http://php.net/manual/en/function.mkdir.php

thanks it works fine




$folder=Yii::getPathOfAlias('webroot.documents.model').DIRECTORY_SEPARATOR;// folder for uploaded files


// you can use the ID or any property that is unique to the model

if(!is_dir($folder.$model->id)){

 	mkdir($folder.$model->id);

}