thom_

Validate

May 27th, 2012
37
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     //var $validate
  2.     var $validate = array(
  3.         //............................
  4.         , 'logo' => array(
  5.             'cekExt' => array(
  6.                 'rule' => array('cekExt', array('jpg'))
  7.                 , 'message' => 'Extensi yang diperbolehkan hanya jpg'
  8.             )
  9.             , 'filenameEmpty' => array(
  10.                 //jika file gagal diupload
  11.                 'rule' => 'filenameEmpty'
  12.                 , 'message' => 'Kesalahan teknis. Upload file gagal dilakukan. Silahkan hubungi Administrator system Anda'
  13.             )
  14.         )
  15.     );
  16.  
  17.  
  18.     //ngisore filenameNotEmpty
  19.     public function cekExt($check, $extensions = array() ) {
  20.         foreach($check as $aryProp){
  21.             if(!empty($aryProp['name'])){
  22.                 #kemungkinan nak isih ra iso, manggil Class iki error e
  23.                 #cobanen utek uteken nak gelem :D
  24.                 #nak ra yo suk we hahahaha...
  25.                 return Validation::extension($check, $extensions);
  26.             }
  27.             return true;
  28.         }
  29.     }
RAW Paste Data