Welcome Guest, Not a member yet? Register   Sign In
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

Theme © iAndrew 2016 - Forum software by © MyBB