Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Private folder files can't access from the view

Hi,

I seen this thread and I'm doing somethink like this. I have put the public files folder inside apps/common/files/img because I don't want than my images are visible from URL that is why I put all my images inside phalcon and not in the public folder.

I can't get my images from te controller but I can't display theses images in my view because I have a 404 error.

How can I access to my private files folder from the view to display them ?

Thanks.



6.9k
Accepted
answer
edited Apr '16

If you have in your template something like this

<img src="apps/common/files/img/...">

then it will not work, because client browser and your webserver cant access private image file. If you want to make it work, you have to serve these images by PHP. Make new route for private images, create new controller and action, which will serve private media for your client.



12.6k

Thanks David. This is a good idea I'll do that.