T
T
tigra2016-09-09 12:58:29
Yii
tigra, 2016-09-09 12:58:29

How to get photo not from web folder in YII2?

I have the path you-project/profile/index where the user's photo should be displayed. User photos are stored in the downloads folder, which is on the same level as the web folder, how do I get these photos?
on the way you-project.ru/downloads/1.jpg naturally does not see.
I came across this article:
ru.stackoverflow.com/questions/485774/yii2-%D1%84%... Using
it, I created a common Media controller in it's action Image, where we pass the name of the photo.
How can I get a photo from youproject/media/image/1.jpg?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2016-09-09
@tigroid3

on the way you-project.ru/downloads/1.jpg naturally does not see.

This is because your web folder is not the root folder. The structure is not correct. Everything in the web should be in the root of the public folder, and the framework itself one level above is a deliverer from a bunch of inconveniences.
Nevertheless, it should work along the path you-project.ru/web/downloads/1.jpg, if it doesn’t work, edit .htaccess

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question