06.01 php saved
dardosordi
Tags add more
 
Note
model using upload behaviour
  1. <?php
  2. class Foto extends AppModel {
  3.  
  4.     var $name = 'Foto';
  5.     var $validate = array(
  6.         'galeria_id' => VALID_NOT_EMPTY
  7.     );
  8.  
  9.     var $actsAs = array(
  10.             'Upload' => array(
  11.                     'imagen' => array(
  12.                             'dir' => 'img/fotos',
  13.                                 'allowed_mime' => array('image/png', 'image/jpeg', 'image/pjpeg'),
  14.                                 'allowed_ext' => array('jpg', 'png'),
  15.                                 'overwrite_existing' => true, 'create_directory' => true)
  16.                 )
  17.     );
  18.  
  19.  
  20.     //The Associations below have been created with all possible keys, those that are not needed can be removed
  21.     var $belongsTo = array(
  22.             'Galeria' => array('className' => 'Galeria',
  23.                                 'foreignKey' => 'galeria_id',
  24.                                 'conditions' => '',
  25.                                 'fields' => '',
  26.                                 'order' => '',
  27.                                 'counterCache' => ''),
  28.     );
  29.  
  30. }
  31. ?>
Parsed in 0.068 seconds, using GeSHi 1.0.7.14

Modify this Paste