5

I'm maintaining to exist project which migrated from another host.

I'm facing this issue where the image from app/media/tf/img/ are broken whereas from other path are working fine. Below are stack trace from error.log

2020-12-04 16:44:47 Error: [MissingControllerException] Controller class TransferController could not be found.
Exception Attributes: array (
  'class' => 'TransferController',
  'plugin' => 'Media',
)
Request URL: /xy/media/tf/img/123.jpg
Stack Trace:
#0 E:\www\xy\xy\app\webroot\index.php(92): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#1 E:\www\xy\xy\index.php(41): require('E:\\www\\xy...')
#2 {main}

Actually, from old server everything's are working fine using the exact same source code. Also, I did tried for the same workaround here but still not working.Glad if someone could help as I'm new to CakePHP.

UPDATE

Just tried to change the path app/img , it is working. It's kind of weird since media/transfer/img are in the same webroot.

img--> tried direct path(app/img/..), working
media--> tried /transfer/img/.. path, not working
manual--> tried direct path(app/manual/..), also not working


But still I need to use the media path and if any explanation for this would be highly appreciated.

enter image description here

Azlina T
  • 176
  • 2
  • 17
  • first, add your cakephp version and double check if exists plugins/Media/.. files – Salines Dec 04 '20 at 14:48
  • Hi, thanks for helping. I'm using version 2.9 and plugins/media/.. are exist. Really dont have idea where is the issue as it has no issue on old server – Azlina T Dec 07 '20 at 01:48
  • I think you must set symlink https://book.cakephp.org/2/en/views/themes.html#theme-assets – Salines Dec 07 '20 at 15:55
  • I'm not sure, but kindly refer to my new update. – Azlina T Dec 08 '20 at 07:03
  • OK,don't post code as image, simple copy here part of your code. Check if symlinks for media assets exist in your app webroot, open terminal, cd to webroot, then `ls -al`, read https://book.cakephp.org/2/en/plugins/how-to-create-plugins.html#plugin-assets – Salines Dec 08 '20 at 08:32
  • Hi, how bout if i'm using Windows machine? I believed for the terminal is used for Linux right? – Azlina T Dec 14 '20 at 02:48
  • 1
    I notice that you referenced a path with `/tf/` in it, but the error message indicates that it's trying to handle this with TransferController. Seems there's some routing happening there which you haven't shown any details of. – Greg Schmidt Dec 19 '20 at 16:22

1 Answers1

0

Check imageBaseUrl in app.php , here we assign the folder for

$this->Html->image();
Shankar Ganesh Jayaraman
  • 1,401
  • 1
  • 16
  • 22
Huzaifa Qidwai
  • 239
  • 1
  • 3
  • Hi, checked inside config/ directory but no app.php file inside. Is it bootstrap.php as I see all the cakeplugin load – Azlina T Dec 28 '20 at 01:59