On Tue, Feb 17, 2009 at 12:23 PM, khurram <[email protected]> wrote:
>
> 5. i have view 'admin_add.ctp'
>
> /app/views/uploads/admin_add.ctp
>
> <?php echo $form->create('Upload', array('type'=>'file')); ?>
> <?php echo $form->input('file', array('type'=>'file')); ?>
> <?php echo $form->end('Submit'); ?>
>
>
> When i execute it
> http://localhost/mysite/uploads/admin_add
>
> then the following error comes.
>
> Missing Method in UploadsController
> Error: The action add is not defined in controller UploadsController
> Error: Create UploadsController::add() in file: app\controllers
> \uploads_controller.php.
> <?php
> class UploadsController extends AppController {
>
> var $name = 'Uploads';
>
>
> function add() {
>
> }
>
> }
> ?>
>
>
> can any body tell me why this error comes ?what is the logic behind
> this error?i did not make add() function in controller but it gives
> the above error..
Yes, that is what the error message is trying to tell you: that the
method is missing.
The problem is with your route. You want to be calling an admin
action, and you're correct in naming the method "admin_add" and the
view "admin_add.ctp". But, in order to call this action, your route
needs to be:
/admin/mysite/uploads/add
Notice that "admin" comes at the front, and the action is just "add".
Cake will take care of switching this to "admin_add" in order to
figure out which action to run. Of course, you'll need to make sure
that core.php has:
Configure::write('Routing.admin', 'admin');
Try that.
For the future, it would be better if you state the
error/problem/whatever at the top of your message, instead of at the
very end, so that people who are reading it can better understand what
to look for when looking at all of the other stuff you include.
Also, if you need to include A LOT of code, such as an entire
controller, you should consider submitting at pastebin.com or
something similar.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---