I installed the Plugin, i do not see any error it is saving to the
Database, but not save the Dir fro the file. and DO not upload the file,
here is my Code :
my Model :
class Picture extends AppModel {
public function beforeValidate() {
$this->data['Picture']['filename']['name'] =
strtolower($this->data['Picture']['filename']['name']);
return true;
}
public $actsAs = array(
'Upload.Upload' => array(
'filename' => array(
'fields' => array(
'dir' => 'dir',
'type' => 'mimetype',
'size' => 'filesize',
),
'thumbnailSizes' => array(
'xvga' => '1024x768',
'vga' => '640x480',
'thumb' => '80x80'
),
'pathMethod' => 'flat',
'path' => '{ROOT}webroot{DS}dvdpictures{DS}'
)
)
);
public $validate = array(
'filename' => array(
'rule' => 'isSuccessfulWrite',
'message' => 'File was unsuccessfully written to the server'
)
);
THE CONTROLLER :
public function add($Subject = null, $idEvento = null) {
if ($this->request->is('post')) {
$this->Picture->create();
$this->request->data['Picture']['filename'] =
AuthComponent::user('id') . '_' . $idEvento . '_' .
$this->request->data['Picture']['filename']['name'];
$this->request->data['Picture']['event_id'] = $idEvento;
$this->request->data['Picture']['created'] = getdate();
if ($this->Picture->save($this->request->data)) {
$this->redirect(array('action' => 'index', $Subject,
$idEvento));
} else {
$this->Session->setFlash(__('The Picture could not be
saved. Please, try again.'));
}
}
}
What am i missing ??
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
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].
Visit this group at http://groups.google.com/group/cake-php?hl=en.