Answer the question
In order to leave comments, you need to log in
How to display uploaded files from backend folder on frontend?
Good afternoon! There is a project on YII2 advanced. When an administrator uploads files, they go to backend/web/uploads. And how to get them out for the client? I tried through aliases, it doesn't work, maybe I'm doing something wrong. I tried to upload to the root uploads folder, I also could not display it for the front.
Answer the question
In order to leave comments, you need to log in
You can specify in frontend/config/params-local.php:
and output:
File url:
<?= Yii::$app->params['backendUrl'] . $model->file ?>
if you use files both in the front and in the backend, then it is better to store them in the -common folder; and output - by assigning them aliases
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question