yii2 Question
My yii2 install in d:\wamp\www\yii2store
I want to get above path to save images which will be uploaded by me or users.
I have pass all available arguments in Yii::getAlias('@webroot')
(below are the lists of argument which I have used).
@yii
- framework directory.
@app
- base path of currently running application.
@runtime
- runtime directory.
@vendor
- Composer vendor directory.
@webroot
- web root directory of currently running web application.
@web
- base URL of currently running web application.
And also once I will get above path to save images then how can I get path something like this localhost/yiistore2/upload
to be use in img tag src.
One more thing how can I create my own alias with Yii::setAlias()
and where to create this so that I can load it on every controller.
If you want to get the root directory of your yii2 project use, assuming that the name of your project is project_app you'll need to use:
on windows you'd see "C:\dir\to\project_app"
on linux you'll get "/var/www/dir/to/your/project_app"
I was formally using:
I hope this helps someone