Attempts to show image more then 2 directories deep throw a missing Controller Error 3.x


#1

I have an image located at webroot/uploads/profiles/partner_1/bg_image.jpg

When I attempt to display it from: uploads/profiles/partner_1/bg_image.jpg

I get the Error:

Error: UploadsController could not be found.

All .htaccess files are unmodified

I experimented placing the target file in different directories and it seems to be a factor of directory depth.

I can find the file in:
/uploads
/uploads/profiles
/img
/img/uploads

Basically anything more then 2 directories deeper then webroot fails. Has anyone else had this issue? Does anyone have an answer that doesn’t involve rewriting my directory to only be 2 levels deep?


#2

I would try removing the _ in partner_1 and partner_2

try partner1 and partner2


#3

Your img file was not in ‘webroot/img’ folder, there for you have to add ‘…/’ in your img Url
your Url to the bg_image should be: ‘…/uploads/profiles/partner-1/bg-image.jpg’
–> this mean: go back to ‘webroot’ folder from ‘webroot/img’ and then access ‘uploads/profiles/partner-1/bg-image.jpg’

<?php echo $this->Html->image('../uploads/profiles/partner-1/bg-image.jpg', ['alt' => 'CakePHP']); ?>

reply result, please!


#4

Turns out that this is a Permissions problem with dynamically generated directories. I opened them up and everything is working as expected.