Im using cakephp 1.2 and the behaviors:
http://trac.assembla.com/cake-base/browser/branches/sample_app/app/models/behaviors/upload.php
http://trac.assembla.com/cake-base/browser/branches/sample_app/app/models/behaviors/image_upload.php
And im trying to upload and save the image without using the
attachments table, here is my problem.
I defined my model as:
Note that i added / after uploads.
----------------------------------------------------------------------
class Test extends AppModel {
var $name = 'Test';
var $actsAs = array('ImageUpload' => array(
'fileField' => 'logo',
'allowedMime' => array('image/jpeg', 'image/gif', 'image/png',
'image/bmp'),
'allowedExt' => array('jpeg', 'jpg', 'gif', 'png', 'bmp'),
'baseDir' => '{APP}uploads/',
'versions' => array('small', 'medium')
)
);
}
?>
----------------------------------------------------------------------
My add action in Tests controller is:
function add() {
if (!empty($this->data)) {
$this->Test->create();
$this->data['Test']['foreign_id'] = $this->user['User']
['id'];
$this->data['Test']['dir'] = 'tests';
$this->data['Test']['class'] = 'tests';
if ($this->Test->save($this->data)) {
$this->Session->setFlash(__('The Test has been saved',
true));
$this->redirect(array('action'=>'index'));
} else {
$this->Session->setFlash(__('The Test could not be
saved. Please, try again.', true));
}
}
}
----------------------------------------------------------------------
Im getting this warnings:
Warning (2): extract() [http://php.net/function.extract]: First
argument should be an array [APP/models/behaviors/upload.php, line
785]
Warning (2): Cannot modify header information - headers already sent
by (output started at /MyPath/httpdocs/cake/basics.php:262) [CORE/cake/
libs/controller/controller.php, line 577]
----------------------------------------------------------------------
The record is added to tests database, the image is uploaded to
the uploads/tests/user_id forlder, but the small and medium sizes are
not created at webroot/img/tests... folder, the folders has 777
permissions,
image magick is installed, also i added the path of the convert to the
safe_mode_exec_dir.
----------------------------------------------------------------------
Any help is welcome, thanks in advanced.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---