I am getting in trouble while creating a new folder using mkdir by passing these variables
I want to create a folder if it does not exist in images/prix folder
here images folder is in the root directory of application, prix folder exists.
It gives the error that
No such file or directory
I suppose you need basePath instead of baseUrl.[s]
I use something like Yii::getPathOfAlias(‘user.avatars’) to get a full path like /var/www/myapp/protected/modules/user/avatars.
P.S: I think it’s better to chmod() after you mkdir() as the way you do it you will get some unexpected results because of umask (at least on *nix systems)
In mkdir() I remember there is a boolean parameter for having it build the whole tree to the dir you want.
I believe you could use realpath() to find the filesystem path from the Url path:
No you can’t. realpath() just returns the absolute path name given a relative path. URL has nothing to do there, you need to use a filesystem path parameter.
Would it work if we used basePath instead of baseUrl?
try to enable recursion , turn on the third parameter