Hi AD7six,

I was wondering how to auto-delete int add action the file uploaded to
{APP} after the file is converted in {IMAGES}?
Just only to keep the converted file and not the original uploaded
file.


Now i can save my image in a single field. Based in modifications to
allow
using a single field to store an image:
http://trac.assembla.com/cake-base/changeset/276/branches/sample_app/app/models/behaviors

Now i have my model like:
        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{DS}',
                                        'dirFormat'             => 
'{$class}{DS}{$foreign_id}',
                                        'overwriteExisting' => true,
                                        'versions'                      => 
array('small' => array(
                                                                                
                        'vBaseDir' =>'{IMAGES}',
                                                                                
                        'vDirFormat' => '{$class}{DS}{$foreign_id}{DS}',
                                                                                
                        'vFileFormat' => 's_{$filename}',
                                                                                
                        'callback' => array('resize', 75, 75)
                                                                                
                )
                                                                                
        )
                                        )
                                );

and my action like:
        function add() {
                if (!empty($this->data)) {

                        $this->Test->create();

                        $this->data['Test']['foreign_id']   = 
2;/*$this->user['User']
['id'];*/
                        $this->data['Test']['class']            = 'tests';

                        //$extension = end(explode('.', 
$this->data['Test']['logo']
['name']));
                        //$filename = String::uuid() . '.' . low($extension);

                        $this->data['Test']['filename']         =  
$this->data['Test']['logo']
['name'];

                        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));
                        }
                }
        }


Thanks in advance.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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