H
H
haa2019-03-16 14:14:20
Yii
haa, 2019-03-16 14:14:20

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

2 answer(s)
L
Lumore, 2019-03-16
@haa

You can specify in frontend/config/params-local.php: and output:

File url:
<?= Yii::$app->params['backendUrl'] . $model->file ?>

M
morricone85, 2019-03-16
@morricone85

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 question

Ask a Question

731 491 924 answers to any question