I'm trying to call the find()
function of a loaded model and I get the following error: Call to undefined function find()
If I can call create()
and save()
, why is find()
undefined?
public function admin_upload() {
$this->layout = 'ajax';
$this->loadModel('TempImage');
$uploadedFileName = $_FILES['data']['name']['Staticpage']['main_image'];
$uploadedType = $_FILES['data']['type']['Staticpage']['main_image'];
$uploadedTmpFileName = $_FILES['data']['tmp_name']['Staticpage']['main_image'];
$uploadedError = $_FILES['data']['error']['Staticpage']['main_image'];
$uploadedSize = $_FILES['data']['size']['Staticpage']['main_image'];
$this->TempImage->create();
$imageData = array(
'name' => $uploadedFileName,
'type' => $uploadedType,
'tmp_name' => $uploadedTmpFileName,
'error' => $uploadedError,
'size' => $uploadedSize
);
$temporaryData = array(
'path' => $imageData
);
$this->TempImage->save($temporaryData);
$lastTempImageThumbPath = $this->TempImage-find(
'first',
array(
'conditions' => array(
'id' => $this->TempImage->getLastInsertID()
)
)
);
$this->set('thumb', $lastTempImageThumbPath['TempImage']['thumb_path']);
}