On Sep 1, 7:31 am, Josoroma <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Somebody knows how to use and configure at model level the upload
> behavior of AD7Six, but without using the attachments 
> table?http://groups.google.com/group/cake-php/browse_thread/thread/8ac41ad9...
>
> Any help is welcome.
> Thanks in advance.

You can use the behavior without a dedicated table, you can even (at
least this is the design) use it without a table at all. It only has
an implied dedicated table by default.

However you can't use magic vars, which refer to submitted data (such
as {$class} in your example) without submitting the data that is
supposed to replace that magic var.

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

You can't do this:
$data = array($model->alias => array('x' => $y .... 'filename' =>
array(..)));
$this->MyModel->save($data);

    var $actsAs = array(
        'ImageUpload' => array(
            'fileFormat'            => '{$missing}/{$filename}',
        )
    );

your problem is that $missing isn't defined in the data and so it
doesn't get replaced - same for $id if it's an add since in beforeSave
which is where the behavior decides what to do, $id will be null. See
the documentation or the behavior errors variable if that explanation
doesn't help you.

hth

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