在 MY_Form_validation 的 fuel cms 中上传文件时无法访问与您的字段名称相对应的错误消息

Unable to access an error message corresponding to your field name -while uploading file in fuel cms in MY_Form_validation

我在 MY_Form_validation class 下写了验证规则 application -> library folder 如下..

public function doc_uploaded($field,$types)
    {
            $types=explode(',',$types);
            $upload = $this->CI->lang->line('upload');
            if(isset($_FILES[$field]) && !empty($_FILES[$field]['name']))
            {
                if(!function_exists('file_upload')){ $this->CI->load->helper('MY_file_helper'); }
                 $status = file_upload(($field),$_FILES[$field], captcha_path(),$types);

           if($status >0 or strlen($status) > 2 )
            {
                return TRUE;
            }
            elseif(is_array($status))
            {
                $this->CI->_error_array[$field] = $status[0];
                $this->CI->_error_array[$field] = $status[0];
                $this->_error_array[$field]=sprintf( $upload,$this->_translate_fieldname($this->_field_data[$field]['label']));
               // echo $field,  print_r($this->_error_array);
             // print_r($this->CI->_error_array);die();
                return FALSE;
            }
            else
            {
                $this->_error_array[$field] = $status[0];
                return FALSE;
            }
        }
        else
        {
            return FALSE;
        }
}

我正在从控制器设置验证规则如下

$this->form_validation->set_rules('resume', 'Resume', 'required|doc_uploaded[pdf,doc,docx,odt,txt,ppt,pptx]');
$_POST['resume'] ='resume';

现在这一个工作正常,除了错误按摩:

Unable to access an error message corresponding to your field name Resume.(doc_uploaded)

一定是解决问题的方法,请帮忙。我正在使用 1.4

而不是

$this->_error_array[$field] = $status[0];

使用

$this->CI->form_validation->set_message('doc_uploaded',$status[0]);

已解决问题