> You can do this:
> $data = array($model->alias => array('x' => $y .... 'filename' =>
> array(..)));
> $this->MyModel->save($data);
>
>     var $actsAs = array(
>         'ImageUpload' => array(
>             'fileFormat'            => '{$x}/{$filename}',
>         )
>     );

Maybe an example will be great. Somebody could share an example?
An example uploading an saving an image field call logotype in the
same table, without using the attachments table:
http://trac.assembla.com/cake-base/browser/branches/sample_app/app/models/behaviors

Just only for testing, in my add action , before save($this->data) im 
declaring:
...
            $this->data['Listing']['filepath']        = 'listings';
            $this->data['Listing']['filename']        = 
$this->data['Listing']['logo'];

            if ($this->Listing->save($this->data)) {
...

In my model im declaring:
...
    var $actsAs = array('ImageUpload' => array(
            'baseDir'        => '{APP}uploads',
            'dirFormat'        => '/listings',
            'fileFormat'    => '{$filename}',
            'versions'         => array(
                                    'small' => array(
                                        'vBaseDir' =>'{IMAGES}',
                                        'vDirFormat' => 'listings/',
                                        'vFileFormat' => 's_{$filename}',
                                        'callback' => array('resize', 
75, 75)
                                    )
                                )
            )
    );
...


$filename is recognized but $filepath dont. Then i manually add 
dirFormat and vDirFormat
but i still getting a lot of errors like:

Warning (512): SQL Error: 1054: Unknown column 'dir' in 'where clause' 
[CORE/cake/libs/model/datasources/dbo_source.php, line 512]
Query: SELECT `Listing`.`id` FROM `mgc_listings` AS `Listing` WHERE 
`dir` = '/listings' AND `filename` = 'cmxforms.gif' LIMIT 1


Warning (2): Invalid argument supplied for foreach() 
[APP/models/behaviors/upload.php, line 286]
app/models/behaviors/image_upload.php (line 513)

convert /MyPath/httpdocs/app/uploads//cmxforms.gif -resize 75x75\> 
/MyPath/httpdocs/app/webroot/img/listings/s_cmxforms.gif

Notice (8): Array to string conversion 
[CORE/cake/libs/model/datasources/dbo_source.php, line 567]


Warning (512): SQL Error: 1054: Unknown column 'Array' in 'field list' 
[CORE/cake/libs/model/datasources/dbo_source.php, line 512]

Query: INSERT INTO `mgc_listings` 
(`name`,`description`,`country_id`,`state_id`,`city_id`,`address`,`contact_name`,`email`,`phone`,`mobile`,`fax`,`logo`,`user_id`,`modified`,`created`)
 
VALUES 
('fffffffffffff','','','','','','','','','','',Array,1,'2008-09-03 
01:03:44','2008-09-03 01:03:44')


Any help is welcome.






--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to