• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
image form validation


I created a callback validation for the files uploaded by a form.
here the code:

function userfile_check(){
            $ff = $_FILES['userfile'];
                $this->form_validation->set_message('userfile_check', 'Image required');
                return FALSE;
            $extension= end(explode(".", $ff['name']));
            $ext = array('jpg','png');
                $this->form_validation->set_message('userfile_check', 'Image not valid');
                return FALSE;
            $this->form_validation->set_message('userfile_check', 'Image required');


    function add() {


        $this->form_validation->set_rules('userfile', 'file', 'callback_userfile_check');



How can transform userfile_check() for use it in MY_Form_validation.php?
I use an helper for my general functions but also in my helper I can't adapt this code.
Both solutions will be appreciate

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.