Ah0y!

I think I have a minor setup problem.

I have Job controller & Document model (which is a copy more or less
of Attachment model in the plugin folder)

In my job model I have:

    var $hasMany = array(
                'QueueShortlist',
        'Document' => array(
            'className' => 'Document',
            'foreignKey' => 'foreign_key',
            'conditions' => array('Document.model' => 'Job'),
            'dependent' => true
                )
        );

and in my document model

        var $validate = array(
                'file' => array(
                        'resource'   => array('rule' => 'checkResource'),
                        'access'     => array('rule' => 'checkAccess'),
                        'location'   => array('rule' => array('checkLocation', 
array(
                                MEDIA_TRANSFER, '/tmp/'
                        ))),
                        'permission' => array('rule' => 
array('checkPermission', '*')),
                        'size'       => array('rule' => array('checkSize', 
'5M')),
                        'extension'  => array('rule' => array('checkExtension', 
false,
array(
                                'jpg', 'jpeg', 'png', 'tif', 'tiff', 'gif', 
'pdf', 'tmp'
                        ))),
                        'mimeType'   => array('rule' => array('checkMimeType', 
false,
array(
                                'image/jpeg', 'image/png', 'image/tiff', 
'image/gif', 'application/
pdf'
                        )))
                )
        );

        var $actsAs = array(
                'Media.Transfer' => array(
                        'trustClient' => false,
                        'transferDirectory' => MEDIA_TRANSFER,
                        'createDirectory' => true,
                        'alternativeFile' => 100
                )
        );

>From my job_controller I'm saving down and my array is:

    [Job]

    ( ... )

    [Document] => Array
        (
            [1] => Array
                (
                    [user_id] => 1
                    [model] => Job
                    [name] => blahblah.pdf
                    [type] => application/pdf
                    [tmp_name] => /Applications/MAMP/tmp/php/php0Jccvo
                    [error] => 0
                    [size] => 2495730
                )
        )

and I

$this->Job->saveAll($this->data, array('validate' => 'first'))

There are no validation errors, everything seems to load and the
tables are updated but the Behaviour doesn't seem to kick in and grab
the base names etc & actually move the file.

Is there missing config for 'transferTo' ? I have set it up with the
core.php pointing to the media core.php so everything is ok there as
far as I know.

Cheeriooo

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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