'checksum',
'group',
'alternative',
+ 'file',
);
+
+ // validate
+ // ファイル容量
+ $filesize = Configure::read('Upload.imagefile.FileSizeMax');
+ if (empty($filesize) || $filesize <= 0) {
+ unset($this->User->Attachment->validate['file']['size']);
+ } else {
+ $this->User->Attachment->validate['file']['size']['rule'] = array('checkSize', $filesize.'K');
+ }
+ //ファイルサイズ
+ $width = Configure::read('Upload.imagefile.WidthMax');
+ $height = Configure::read('Upload.imagefile.HeightMax');
+ if ((empty($width) || $width <= 0) || (empty($height) || $height <= 0)) {
+ unset($this->User->Attachment->validate['file']['pixels']);
+ } else {
+ $this->User->Attachment->validate['file']['pixels']['rule'] = array('checkPixels', $width.'x'.$height);
+ }
+
if ($this->User->saveAll($this->data, array(
'validate' => 'first',
'fieldList' => $fieldList
function __construct($id = false, $table = null, $ds = null) {
+ // Uploadファイルの保存設定
$this->actsAs['Media.Transfer']['destinationFile'] = ':Medium.short::DS::uuid:'.'.'.':Source.extension:';
+ // validate
+ $this->validate['file']['extension'] = array('rule' => array('checkExtension', false, array(
+ 'jpg', 'jpeg', 'png', 'gif',
+ )));
+ $this->validate['file']['notEmpty'] = array('rule' => array('checkMimeType', false, array(
+ 'image/jpeg', 'image/png', 'image/gif'
+ )));
+
parent::__construct($id, $table, $ds);
}