cakephp add new controller path

394 Views Asked by At

Background: I'm new to CakePHP and trying to modify an preexisting project. When I try to add a new UploadsController it is supposed to handle xxxx/uploads requests right? However, when entering the url neither AppController or UploadsController, allow index.php to do a dispatch. Files are being called. It goes straight to /uploads which is a directory.

I realize this is a bad design to begin with but trying to fix things one step at a time. Need to authenticate before going to /uploads, and than take action.

What am I doing wrong? I tried to modify routes.php to specify controller but that does not work either.

2

There are 2 best solutions below

0
On

So as I said I am new and fixing someone else's project. I found that there is a security issue where uploads directory is exposed. So I figured I would add Controller to take care of this. uploads folder was under webroot as a result it was going to uploads folder and was not directing to controller. Thanks and hopes this helps someone in the future.. although kind of doubt it since it was a really bad way to do this to begin with.

3
On

With the info you gave this is what I can suggest:

  1. Check to see if the UploadsController is in the Controller folder.
  2. Make sure that there's at least a index.ctp file in Views/Uploads/
  3. Check to see if the UploadsController has a default index() method. This is what www.example.com/uploads/ will hit.