cakephp - Declaration of Upload::beforeSave() should be compatible with Model::beforeSave($options = Array) [APP/Model/Upload.php, line 5] -
i being shown following error on top of page when using beforesave method in upload model.
strict (2048): declaration of upload::beforesave() should compatible model::beforesave($options = array) [app/model/upload.php, line 5]
could point out i'm doing wrong?
here model:
<?php app::uses('appmodel', 'model'); class upload extends appmodel { protected function _processfile() { $file = $this->data['upload']['file']; if ($file['error'] === upload_err_ok) { $name = md5($file['name']); $path = www_root . 'files' . ds . $name; if (is_uploaded_file($file['tmp_name']) && move_uploaded_file($file['tmp_name'], $path) ) { $this->data['upload']['name'] = $file['name']; $this->data['upload']['size'] = $file['size']; $this->data['upload']['mime'] = $file['type']; $this->data['upload']['path'] = '/files/' . $name; unset($this->data['upload']['file']); return true; } } return false; } public function beforesave() { if (!parent::beforesave($options)) { return false; } return $this->_processfile(); } } ?>
just change line
public function beforesave() {
to this, have correct method declaration
public function beforesave($options = array()) {
Comments
Post a Comment