I am trying to use the Attachment component (seen here). I followed the instructions and added this to my view:
<?= $this->Form->create('Event', array('type' => 'file'); ?>
<?= $this->Form->file('image_attach'); ?>
Then added this into my controller's
$this->data['Event']['image'] = $this->Attachment->upload($this->data['Event']['image_attach']);
I also declared this at the top of my controller class:
var $components = array('Attachment' => array(
'photos_dir' => 'events'
When the form is submitted, I have it
data variable to see what's being added. But before that happens, I get this error.
Notice (8): Undefined index: event [APP/controllers/components/attachment.php, line 67]
I've tried looking in the component's file, and all I can tell is it's trying to find an index that is the name of my model in the array I pass through. But, I already figured that out from the error above.
I just want to know if I've done something wrong, or what might be causing this to happen, whether it's my fault or the component's?
hmmm after reading the component... it seems to me that you need to call the
upload() method like this: