Matteo Landi | 30 Jun 2012 10:51
Picon

Help Upload plugin: validation rules

Hi all,
is anybody using Jose Gonzalez's upload plugin [1]?  I have a couple
of open issues regarding its integration inside my web app, but before
filing a bug I wanted to be sure I was doing things the right way.

I attached a couple of validation rules to my Model's attachment
property and they seem to work only while adding a new object to the
database.  If I edit an object, all the rules are processed but they
always return true.

    public $actsAs = array(
		'Upload.Upload' => array(
			'attachment' => array(
				'mimetypes' => array(
					'application/pdf',
				)
			)
		),
	);

	public $validate = array(
		'attachment' => array(
			'valid' => array(
				'rule' => array('isValidMimeType', array(), false),
				'message' => 'File is of an invalid mimetype',
			),
		),
	);

I had a look at the rule code, and on edit operations the function
(Continue reading)


Gmane