CodeIgniter Forums
image form validation - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: image form validation (/thread-33007.html)

image form validation - El Forum - 08-12-2010


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