How Can I Set Upload Dirctory ?

Hello everyone!

I am useing Yii2 advanced template which have frontend and backend.

I need upload image to server in backend, the image url store into a table. and make sure user from frontend and manage user from backend both can see the image.

but how can I set the image url?

we know:

@web, the base URL of the currently running Web application

but in backend, the @web means backend web base URL and in frontend the @web means frontend web base URL.

if I even don’t know what domain name exactly on my project, so how do I store the url of image just upload?

I am not good at English, I hope you can understand.


You can symlink a directory to both frontend and backend.

Thanks for reply.

I use set alias to resolve it. like:

Yii::setAlias(‘upload’, ‘’);